diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index a465b9e..e578a39 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -1276,6 +1276,25 @@ class optional namespace boost { +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + +template +inline +optional::type> make_optional ( T && v ) +{ + return optional::type>(boost::forward(v)); +} + +// Returns optional(cond,v) +template +inline +optional::type> make_optional ( bool cond, T && v ) +{ + return optional::type>(cond,boost::forward(v)); +} + +#else + // Returns optional(v) template inline @@ -1292,6 +1311,8 @@ optional make_optional ( bool cond, T const& v ) return optional(cond,v); } +#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. // No-throw template