@@ -44,7 +44,7 @@ class box
4444
4545 template <typename ... Args>
4646 holder (Args&&... args)
47- : value{ std::forward<Args>(args)...}
47+ : value( std::forward<Args>(args)...)
4848 {
4949 }
5050 };
@@ -77,7 +77,10 @@ class box
7777 */
7878 template <typename Arg,
7979 typename Enable = std::enable_if_t <
80- !std::is_same<box, std::decay_t <Arg>>::value>>
80+ !std::is_same<box, std::decay_t <Arg>>::value>,
81+ // this is similar to std::is_constructible but works around the
82+ // fact that is_constructible is ill-formed for incomplete types
83+ typename = decltype (T(std::declval<Arg>()))>
8184 box (Arg&& arg)
8285 : impl_{detail::make<heap, holder>(std::forward<Arg>(arg))}
8386 {
@@ -86,7 +89,14 @@ class box
8689 /* !
8790 * Constructs a box holding `T{arg1, arg2, args...}`
8891 */
89- template <typename Arg1, typename Arg2, typename ... Args>
92+ template <typename Arg1,
93+ typename Arg2,
94+ typename ... Args,
95+ // this is similar to std::is_constructible but works around the
96+ // fact that is_constructible is ill-formed for incomplete types
97+ typename = decltype (T(std::declval<Arg1>(),
98+ std::declval<Arg2>(),
99+ std::declval<Args>()...))>
90100 box (Arg1&& arg1, Arg2&& arg2, Args&&... args)
91101 : impl_{detail::make<heap, holder>(std::forward<Arg1>(arg1),
92102 std::forward<Arg2>(arg2),
0 commit comments