AMDG
Kraus Philipp wrote:
I have a problem with the boost libs (1.42). Your code compiles
without errors, but
in the "operator_lambda_func_base.hpp" at line 135 the compilere shows
the error
4 times:
conversion from 'double' to non-scalar type
'boost::lambda::detail::unspecified' requested
<snip>
Can you please help to solve this problem?
Obviously I should have tried to compile before posting...
Apparently Lambda doesn't work with uBLAS by default.
#include
#include
#include
#include
#include <algorithm>
#include <iostream>
namespace ublas = boost::numeric::ublas;
namespace boost {
namespace lambda {
template
struct plain_return_type_2,
ublas::vector, B> {
typedef typename ublas::vector::reference type;
};
}
}
int main() {
ublas::vector<long double> vec(5);
vec[0] = 2.0;
vec[1] = 1.0;
vec[2] = 3.0;
vec[3] = 5.0;
vec[4] = 4.0;
using namespace boost::lambda;
std::vectorstd::size_t
temp(boost::counting_iteratorstd::size_t(0),
boost::counting_iteratorstd::size_t(vec.size()));
std::sort(temp.begin(), temp.end(), var(vec)[_1] < var(vec)[_2]);
std::vectorstd::size_t ranking(temp.size());
std::copy(boost::counting_iteratorstd::size_t(0),
boost::counting_iteratorstd::size_t(vec.size()),
boost::make_permutation_iterator(ranking.begin(), temp.begin()));
std::copy(ranking.begin(), ranking.end(),
std::ostream_iteratorstd::size_t(std::cout, " "));
}
In Christ,
Steven Watanabe