Boost logo

Boost :

Subject: [boost] [constrained_value] need help with runtime error
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2008-12-10 14:33:09


This code has an error:

#include <boost/numeric/ublas/vector.hpp>
#include <boost/constrained_value.hpp>

namespace cv = boost::constrained_value;
namespace ublas = boost::numeric::ublas;

typedef cv::bounded<int>::type val_t;
typedef cv::bounded<int>::type::constraint_type constraint_type;

int main() {
  int min = -200;
  int max = 200;
  val_t init (10, constraint_type (min, max));
  ublas::vector<val_t> v (10, init);
  ublas::vector<val_t> w = -v;
}

This code will throw an exception. The last line invokes:
ublas/functional.hpp:70 (scalar_negate), which for some reason calls

constrained.hpp:224, which is:
    constrained(const value_type & v)

That is, initialize only the value, not the constraint! Any ideas?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk