« Return to Thread: ublas::vector in std::map
I am working on a fieldmap object based on std::map of ublas::bounded_vectors so that I can take advantage of matrix multiplication of ublas as well as the storage/iterators of std::map. However, ublas::vector (and ublas::bounded_vector) do not have the necessary properties to comply with the requirements of the Key value of a std::map.martux wrote:Hi, I tried using a ublas vector as key type in a std::map along the lines of
boost::ublas::vector<double> x(2);
std::map<boost::ublas::vector<double>, int> vm;
vm[x] = 1;
which wont compile (gcc 4.0.3) due to
/usr/lib/gcc/x86_64-linux-gnu/4.0.3/../../../../include/c++/4.0.3/bits/stl_function.h:227: error: no match
for ‘operator<’ in ‘__x < __y’.
Adding an implementation of
bool operator<(boost::ublas::vector<double> const& A, boost::ublas::vector<double> const& B) {...}
unfortunately doesnt help. Could anyone please point out what I am missing?
« Return to Thread: ublas::vector in std::map
| Free embeddable forum powered by Nabble | Forum Help |