It could be any of the following reasons, which is described on unity doc.
please check with this.
Android Notes
* Support for resolutions above 640 x 360 is not available on all devices. Runtime checks are done to verify this and failures will cause the movie to not be played.
* For Jelly Bean/MR1, movies above 1280 x 720 or with more than 2 audio tracks will not be played due to bugs in the OS libraries.
* For Lollipop and above, any resolution or number of audio channels may be attempted, but will be constrained by device capabilities.
* The Vulkan graphics API is not yet supported.
* Format compatibility issues are reported in the adb logcat output and are always prefixed with AndroidVideoMedia.
* Also pay attention to device-specific error messages located near Unity's error messages: they are not available to the engine, but often explain what the compatibility issue is.
* Playback from asset bundles is only supported for uncompressed bundles, read directly from disk.
сделайте изменения в Калькуляторе и основной функции.
struct Calculator
{
double operator() ( double result, const Object& obj )
{
return result + ( obj.GetA() * obj.GetB());
}
};
int main()
{
std::vector< Object > collection;
collection.push_back( Object( 1, 2 ) );
collection.push_back( Object( 3, 4 ) );
double result = std::accumulate( collection.begin(), collection.end(), 0, Calculator() );
std::cout << "result = " << result << std::endl;
return 0;
}
также это могло быть лучше:
double sumABProduct( double result, const Object& obj )
{
return result + ( obj.GetA() * obj.GetB());
}
double result = std::accumulate( collection.begin(), collection.end(), 0, sumABProduct );
Обновление 2: Повышение. Лямбда делает это куском пирога:
// headers
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
using namespace boost::lambda;
// ...
cout << accumulate(dv.begin(), dv.end(),
0,
_1 += bind(&strange::value, _2)) //strange defined below
<< endl;
Обновление: Это прослушивало меня некоторое время. Я не могу только заставить ни один из алгоритмов STL работать достойным способом. Так, я прокрутил свое собственное:
// include whatever ...
using namespace std;
// custom accumulator that computes a result of the
// form: result += object.method();
// all other members same as that of std::accumulate
template <class I, class V, class Fn1, class Fn2>
V accumulate2(I first, I last, V val, Fn1 op, Fn2 memfn) {
for (; first != last; ++first)
val = op(val, memfn(*first));
return val;
}
struct strange {
strange(int a, int b) : _a(a), _b(b) {}
int value() { return _a + 10 * _b; }
int _a, _b;
};
int main() {
std::vector<strange> dv;
dv.push_back(strange(1, 3));
dv.push_back(strange(4, 6));
dv.push_back(strange(20, -11));
cout << accumulate2(dv.begin(), dv.end(),
0, std::plus<int>(),
mem_fun_ref(&strange::value)) << endl;
}
Конечно, исходное решение все еще содержит: самое легкое должно реализовать operator+
. В этом случае:
double operator+(double v, Object const& x) {
return v + x.a_;
}
и сделайте это другом Object
или участник (ищут, почему можно предпочесть один по другому):
class Object
{
//...
friend double operator+(double v, Object const& x);
и Вы, покончите:
result = accumulate(collection.begin(), collection.end(), 0.0);
Мой более ранний подход не работает, потому что нам нужен a binary_function
.
станд.:: накопите руководство.
Можно было бы надеяться, что это - домашняя работа...
struct Adapt {
static double mul(Object const &x) { return x.GetA() * x.GetB(); }
static double operator()(Object const &x, Object const &y) {
return mul(x)+mul(y); } };
и
result = std::accumulate(collection.begin(), collection.end(), Object(0,0),Adapt() );
принятие Нельзя коснуться объявления Объекта.