Opened 12 years ago
Last modified 12 years ago
#4443 new Bugs
Bounded vector constructor missing explicit and an initialization version
Reported by: | Owned by: | Gunter | |
---|---|---|---|
Milestone: | Boost 1.44.0 | Component: | uBLAS |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | Cc: |
Description
While vector<> has an 'explicit' on its constructor with unsigned integers, bounded_vector does not. This means the following ugliness compiles: bounded_vector<double, 2> v; v = 2; This SHOULDN'T compile if the patch is applied. Using cast to unsigned int.
Also, while vector<> has a constructor that takes a size and then a value to initialize with, bounded_vector does not. I added in a constructor for this operation and for consistency, so the following compiles: ublas::vector<double> v(2, 1.8); ublas::bounded_vector<double,2> v(2, 1.8); Now consistent.
.... this became necessary when I was doing programming for generic vector types and wanted to construct with an initial value.
Attachments (2)
Change History (3)
by , 12 years ago
Attachment: | bounded_vector_constructors.patch added |
---|
by , 12 years ago
Attachment: | test_boost_ublas_vector_constructors.cpp added |
---|
I have been porting some of my code to GCC and may have made a mistake on here. the value_type is not available here, so it should be added as a typdef in the bounded_vector class:
Also, gcc didn't like my begin() and end() in the constructor with fill, so try adding a this->begin() and this->end() instead. I am not sure the best way to do this.