2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2014-01-08 07:48:12 +00:00
|
|
|
Copyright (c) 2011-2014 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
=============================================================================*/
|
2012-10-22 14:10:11 +00:00
|
|
|
#ifndef SPROUT_OPTIONAL_MAKE_OPTIONAL_HPP
|
|
|
|
#define SPROUT_OPTIONAL_MAKE_OPTIONAL_HPP
|
|
|
|
|
2013-05-18 12:37:54 +00:00
|
|
|
#include <type_traits>
|
2012-10-22 14:10:11 +00:00
|
|
|
#include <sprout/config.hpp>
|
|
|
|
#include <sprout/optional/optional.hpp>
|
2013-05-18 12:37:54 +00:00
|
|
|
#include <sprout/utility/forward.hpp>
|
2012-10-22 14:10:11 +00:00
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
//
|
|
|
|
// make_optional
|
|
|
|
//
|
|
|
|
template<typename T>
|
2013-05-18 12:37:54 +00:00
|
|
|
inline SPROUT_CONSTEXPR sprout::optional<typename std::decay<T>::type>
|
|
|
|
make_optional(T&& v) {
|
|
|
|
return sprout::optional<typename std::decay<T>::type>(sprout::forward<T>(v));
|
2012-10-22 14:10:11 +00:00
|
|
|
}
|
|
|
|
template<typename T>
|
2013-05-18 12:37:54 +00:00
|
|
|
inline SPROUT_CONSTEXPR sprout::optional<typename std::decay<T>::type>
|
|
|
|
make_optional(bool cond, T&& v) {
|
|
|
|
return sprout::optional<typename std::decay<T>::type>(cond, sprout::forward<T>(v));
|
2012-10-22 14:10:11 +00:00
|
|
|
}
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_OPTIONAL_MAKE_OPTIONAL_HPP
|