From 9ca88083ac0d10da57797dd4e3be6108b604c4cd Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Mon, 1 Jul 2013 16:57:56 +0900 Subject: [PATCH] support for GCC4.7: optional in-place constructor --- sprout/optional/optional.hpp | 13 +++++++++---- sprout/utility/value_holder/value_holder.hpp | 9 +++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sprout/optional/optional.hpp b/sprout/optional/optional.hpp index f1d5f244..3a1d121d 100644 --- a/sprout/optional/optional.hpp +++ b/sprout/optional/optional.hpp @@ -42,6 +42,11 @@ namespace sprout { typedef typename holder_type::reference_const_type reference_const_type; typedef typename holder_type::pointer_type pointer_type; typedef typename holder_type::pointer_const_type pointer_const_type; + public: + template + struct is_constructible_args + : public std::is_constructible + {}; public: static SPROUT_CONSTEXPR reference_type get(optional& t) SPROUT_NOEXCEPT { return sprout::get(t.val); @@ -108,7 +113,7 @@ namespace sprout { {} template< typename... Args, - typename = typename std::enable_if::value>::type + typename = typename std::enable_if::value>::type > explicit SPROUT_CONSTEXPR optional(sprout::in_place_t, Args&&... args) : init(true) @@ -116,7 +121,7 @@ namespace sprout { {} template< typename U, typename... Args, - typename = typename std::enable_if&, Args&&...>::value>::type + typename = typename std::enable_if&, Args...>::value>::type > explicit SPROUT_CONSTEXPR optional(sprout::in_place_t, std::initializer_list il, Args&&... args) : init(true) @@ -177,7 +182,7 @@ namespace sprout { template< typename... Args, - typename = typename std::enable_if::value>::type + typename = typename std::enable_if::value>::type > void emplace(Args&&... args) { optional temp(sprout::in_place, sprout::forward(args)...); @@ -185,7 +190,7 @@ namespace sprout { } template< typename U, typename... Args, - typename = typename std::enable_if&, Args&&...>::value>::type + typename = typename std::enable_if&, Args...>::value>::type > void emplace(std::initializer_list il, Args&&... args) { optional temp(sprout::in_place, il, sprout::forward(args)...); diff --git a/sprout/utility/value_holder/value_holder.hpp b/sprout/utility/value_holder/value_holder.hpp index ce441d3f..f8b59fa2 100644 --- a/sprout/utility/value_holder/value_holder.hpp +++ b/sprout/utility/value_holder/value_holder.hpp @@ -174,6 +174,11 @@ namespace sprout { typedef mutable_or_const_pointer pointer_const_type; typedef param_type argument_type; typedef movable_param_type movable_argument_type; + public: + template + struct is_constructible_args + : public std::is_constructible + {}; public: static SPROUT_CONSTEXPR reference get(value_holder& t) SPROUT_NOEXCEPT { return helper_type::ref(t.holder_); @@ -209,14 +214,14 @@ namespace sprout { {} template< typename... Args, - typename = typename std::enable_if::value>::type + typename = typename std::enable_if::value>::type > explicit SPROUT_CONSTEXPR value_holder(sprout::in_place_t, Args&&... args) : holder_(sprout::forward(args)...) {} template< typename U, typename... Args, - typename = typename std::enable_if&, Args&&...>::value>::type + typename = typename std::enable_if&, Args...>::value>::type > explicit SPROUT_CONSTEXPR value_holder(sprout::in_place_t, std::initializer_list il, Args&&... args) : holder_(il, sprout::forward(args)...)