
2016-05-30 13:21 GMT+02:00 Krzysztof Czainski <1czajnik@gmail.com>:
2016-05-30 12:46 GMT+02:00 Andrey Semashev <andrey.semashev@gmail.com>:
2016-05-30 11:29 GMT+02:00 Andrey Semashev <andrey.semashev@gmail.com>:
The typed in-place factories ruin the solution though, even if not used by
On Monday, 30 May 2016 13:45:28 MSK Krzysztof Czainski wrote: optional.
How so?
Typed in-place factory requires an explicit template parameter to be specified, which is not achievable if in_place is an object.
Oh yeah. Too bad a variable template cannot be "overloaded" with the non-template function object.
Maybe in_place can be hacked as is without changing it to a function object? Here's a proof of concept. It compiles [1], so it seems 'in_place' can be used as a tag with the current implementation of boost::in_place() overloads. [1] http://ideone.com/zzbwq4 1. struct in_place_factory0 {}; 2. 3. in_place_factory0 in_place() {} 4. template <class T> void in_place(T) {} 5. template <class T, class U> void in_place(T, U) {} 6. 7. void test(in_place_factory0 (&in_place_tag)()) {} 8. 9. int main() { 10. test(in_place); 11. }