Why does this give the error: Test::Test: no overloaded function takes 2 arguments
class Test
{
public:
Test(const std::vector<int>&)
{
}
};
Test test(boost::assign::list_of(4));
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The implementation of boost::assign::list_of requires the container type, in this case your Test class, to have a two argument constructor that takes a first and last iterator (aka range) to initialize the container with.
Specifically, the error comes from the line below with return Container in the convert metho of the boost::assign_detail::converter class:
The reason hmjd’s workaround is successful is that std::vector has a constructor takes two iterators.