I wonder if there is the \"nicer\" way of initialising a static vector than below?
class Foo
{
static std::vector MyVector;
Foo()
{
with boost you can use the +=() operator defined in the boost::assign namespace.
#include
using namespace boost::assign;
int main()
{
static std::vector MyVector;
MyVector += 4,17,20;
return 0;
}
or with static initialization:
#include
using namespace boost::assign;
static std::vector myVector = list_of(4)(17)(2);
int main()
{
return 0;
}
or even better, if your compiler supports C++ 11, use initialization lists.