Boost logo

Boost Users :

Subject: [Boost-users] [boost-users] [assign] std::vector initialisation by boost::assign::list_of
From: Andrey Torba (andreytorba_at_[hidden])
Date: 2010-03-17 08:32:11


The code is compilable on msvc but is not on gcc-4.3:

#include <boost/assign/list_of.hpp>
#include <vector>

int main()
{
  //OK
  std::vector<int> v = boost::assign::list_of(1)(2);

  // error
  std::vector<int> v(boost::assign::list_of(1)(2));
  return 0;
}

I can initialise std::vector in a first way.
But the problem occurs when i try to initialise std::vector in a class
initialization list:
class sss
{
  std::vector<int> v;
  sss()
    : v(boost::assign::list_of(1)(2))
  {}
};

-- 
Regards, Andrey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net