Boost logo

Boost :

Subject: [boost] [multi_index] problems with initializer lists in Visual Studio 2013
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2013-10-20 05:00:05


I think this is related to the similar problem just discussed in
connection with Boost.Unordered with the same compiler. The following

  struct employee
  {
    employee(int id_,std::string name_,int age_,int ssn_);
    // ...
  };

  employee_set es8({{0,"Rose",40,4512},{1,"Mary",38,3345},
    {2,"Jo",25,7102}});

gives me (see http://tinyurl.com/pg4fsln )

..\libs\multi_index\test\test_copy_assignment.cpp(159) : error C2440:
 'initializing' : cannot convert from 'initializer-list' to
 'boost::multi_index::multi_index_container<[...]>'
  No constructor could take the source type, or constructor overload
  resolution was ambiguous

and this

  es9={{0,"Rose",40,4512},{1,"Mary",38,3345},{2,"Jo",25,7102},
       {0,"Rose",40,4512}};

results in

..\libs\multi_index\test\test_copy_assignment.cpp(162) : error C2593:
  'operator =' is ambiguous
  D:\teeks99-10\boost\boost/multi_index_container.hpp(329): could be
  'boost::multi_index::multi_index_container<[...]>
  &boost::multi_index::multi_index_container<[...]>::operator=
   (std::initializer_list<employee>)'
  D:\teeks99-10\boost\boost/multi_index_container.hpp(321): or
  'boost::multi_index::multi_index_container<[...]>
  &boost::multi_index::multi_index_container<[...]>::operator =
    (boost::multi_index::multi_index_container<[...]> &&)'
  D:\teeks99-10\boost\boost/multi_index_container.hpp(313): or
  'boost::multi_index::multi_index_container<[...]>
  &boost::multi_index::multi_index_container<[...]>::operator =
    (const boost::multi_index::multi_index_container<[...]> &)'
  while trying to match the argument list '(employee_set,
  initializer-list)'

Is this the compiler's fault or mine? Any applicable library-side
workarond?

Thank you,

Joaquín M López Muñoz
Telefónica Digital


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