Subject: Re: [boost] boost::indeterminate and std::vector::emplace_back()
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2012-04-04 16:05:24
> there is a problem when using boost::indeterminate in conjunction with
> std::vector<boost::tribool> v;
> In VS2010, this code causes
> error C2383: '_Valty' : default-arguments are not allowed on this symbol
> The error occurs becasue emplace_back's _Valty template parameter is deduced as the type of boost::indeterminate which is a function with a default argument.
I observe that this doesn't compile with VC10 SP1 and Boost 1.49.0, but it DOES compile with my current build of VC11. I believe that a compiler bug was fixed here - there were several things wrong with VC10 SP1's emplace_back() (it was implemented for only 1 argument, and it was also incorrectly overloaded), but its core functionality of perfect forwarding appears to have been correct. Nothing should stop you from passing a function to a perfect forwarder, even a function with default arguments, as long as the function is not overloaded and not a template (otherwise it would be ambiguous which one you want, and there would be no context to disambiguate - you would have to manually static_cast).
Stephan T. Lavavej
Visual C++ Libraries Developer
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk