|
Boost Users : |
Subject: Re: [Boost-users] [Assign] Error using list_of() with Visual C++ 2010 Beta 1
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-09-08 05:13:09
Paul Baker skrev:
> In the Boost.Assign documentation, the following example of list_of() is given:
>
> const list<int> primes = list_of(2)(3)(5)(7)(11);
>
> However, I have tended to write this instead:
>
> const list<int> primes(list_of(2)(3)(5)(7)(11));
>
> This is causing problems with the Microsoft Visual C++ 2010 Beta 1
> compiler. Using Visual C++ 2008, both lines compile fine but with 2010
> Beta 1, the second produces the following error:
>
> error C2668: 'std::list<_Ty>::list' : ambiguous call to overloaded
> function with [_Ty=int]
> could be 'std::list<_Ty>::list(std::list<_Ty> &&)' with [_Ty=int]
> or 'std::list<_Ty>::list(unsigned int)' with [_Ty=int]
> while trying to match the argument list
> '(boost::assign_detail::generic_list<T>)' with [T=int]
>
> Is this:
>
> a) My fault? Should I be using copy initialization rather than
> direct initialization?
Well, if it works more portably, then why not.
> b) A problem with the 2010 beta compiler?
I really don't know. Try to ask a question on some newsgroup with some
C++ gurus.
> or c) A problem with Boost.Assign?
Well, I think Boost.Assign does everything it can.
-Thorsten
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