Subject: [Boost-bugs] [Boost C++ Libraries] #1785: assign::list_of works poorly with class constructors
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-04-07 11:56:16
#1785: assign::list_of works poorly with class constructors
---------------------------+------------------------------------------------
Reporter: tailsu_at_[hidden] | Owner: nesotto
Type: Bugs | Status: new
Milestone: Boost 1.36.0 | Component: assign
Version: Boost 1.35.0 | Severity: Problem
Keywords: list_of |
---------------------------+------------------------------------------------
try compiling the following snippet:
#include <boost/assign/list_of.hpp>
using namespace boost::assign;
class foo
{
public:
foo(const vector<int>& a) {}
};
void bar()
{
foo a(list_of(0));
}
at the line 'foo a(list_of(0))' the compiler (VC8) thinks I want to call
the copy contructor of foo, instead of the constructor that would cause a
conversion to vector<int>. This case requires an explicit conversion, or
using a different constructor prototype that doesn't overload the copy
constructor.
Please, advise which is the best way to use list_of in this scenario.
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1785>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC