I was looking at one of the answers to: filling a boost vector or matrix but I think I'm new to boost(and xcode, for that matter) and am trying to wrap my head around the boost zero_vector.
I tried a simple program that I thought was about the same as one of the answers:
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main (int argc, char * const argv[]) {
// insert code here...
using namespace boost::numeric::ublas;
int gameSize = 9;
typedef vector<int> possiblesVector;
possiblesVector foo;
foo.resize(gameSize);
foo = zero_vector<int>(gameSize);
std::cout << foo << std::endl;
return 0;
}
which compiles, but when it runs, I get a runtime error (substituting "/PATH/TO" for the real path).
Check failed in file /PATH/TO/boost_1_48_0/boost/numeric/ublas/detail/vector_assign.hpp at line 370:
detail::expression_type_check (v, cv)
terminate called after throwing an instance of 'boost::numeric::ublas::external_logic'
what(): external logic or bad condition of inputs
Program received signal: “SIGABRT”.
sharedlibrary apply-load-rules all
Here, I'm just using a single main.cpp as a test area. In my real program, I have the declarations split into a .h file and my initializations in a .cpp file of my object. But the above code fails in the same way as my real program. (i.e. why I'm splitting declare and initialization into 2 steps)
Also, I know the resize already initializes to zero. Maybe I'll do a scalar_vector instead, or maybe I'll need to reset the array later on or something. I was just trying to isolate the code that is breaking.