
On Dec 10, 2008, at 2:57 PM, Neal Becker wrote:
// template<typename V, typename C, typename E> // cv::constrained<V,C,E> & operator- (cv::constrained<V,C,E> c) { // V tmp (c.value()); // c = -tmp; // return c; // }
int main() { int min = -200; int max = 200; val_t init (10, constraint_type (min, max)); val_t neg_x(-init);
If the above operator overload is uncommented, then it does not throw on the last line above, but it STILL throws on the original vector operation:
ublas::vector<val_t> v (10, init); ublas::vector<val_t> w = -v;
I can't figure out why the ublas scalar_negate doesn't use my operator-.
I think that operator would have to be in the constrained_value namespace for ADL to find it when compiling in the ublas namespace; no ADL is necessary when you define the overload in the current namespace. Gordon