Sprout/sprout/optional/get.hpp

77 lines
2.6 KiB
C++
Raw Normal View History

2012-10-22 14:10:11 +00:00
#ifndef SPROUT_OPTIONAL_GET_HPP
#define SPROUT_OPTIONAL_GET_HPP
#include <sprout/config.hpp>
#include <sprout/optional/optional.hpp>
namespace sprout {
//
// get
//
template<typename T>
inline SPROUT_CONSTEXPR typename sprout::optional<T>::reference_type
get(sprout::optional<T>& x) {
return sprout::optional<T>::get(x);
}
template<typename T>
inline SPROUT_CONSTEXPR typename sprout::optional<T>::rvalue_reference_type
get(sprout::optional<T>&& x) {
return sprout::optional<T>::get(sprout::move(x));
}
template<typename T>
2012-10-22 14:10:11 +00:00
inline SPROUT_CONSTEXPR typename sprout::optional<T>::reference_const_type
get(sprout::optional<T> const& x) {
return sprout::optional<T>::get(x);
2012-10-22 14:10:11 +00:00
}
template<typename T>
inline SPROUT_CONSTEXPR typename sprout::optional<T>::pointer_type
get(sprout::optional<T>* x) {
return sprout::optional<T>::get_pointer(*x);
2012-10-22 14:10:11 +00:00
}
template<typename T>
inline SPROUT_CONSTEXPR typename sprout::optional<T>::pointer_const_type
get(sprout::optional<T> const* x) {
return sprout::optional<T>::get_pointer(*x);
2012-10-22 14:10:11 +00:00
}
//
// get_pointer
//
template<typename T>
inline SPROUT_CONSTEXPR typename sprout::optional<T>::pointer_type
get_pointer(sprout::optional<T>& x) {
return sprout::optional<T>::get_pointer(x);
2012-10-22 14:10:11 +00:00
}
template<typename T>
inline SPROUT_CONSTEXPR typename sprout::optional<T>::pointer_type
get_pointer(sprout::optional<T>&& x) {
return sprout::optional<T>::get_pointer(sprout::move(x));
}
template<typename T>
inline SPROUT_CONSTEXPR typename sprout::optional<T>::pointer_const_type
get_pointer(sprout::optional<T> const& x) {
return sprout::optional<T>::get_pointer(x);
2012-10-22 14:10:11 +00:00
}
//
// get_value_or
2012-10-22 14:10:11 +00:00
//
template<typename T>
inline SPROUT_CONSTEXPR typename sprout::optional<T>::reference_type
get_value_or(sprout::optional<T>& x, typename sprout::optional<T>::reference_type v) {
return sprout::optional<T>::get_value_or(x, v);
2012-10-22 14:10:11 +00:00
}
template<typename T>
inline SPROUT_CONSTEXPR typename sprout::optional<T>::rvalue_reference_type
get_value_or(sprout::optional<T>&& x, typename sprout::optional<T>::rvalue_reference_type v) {
return sprout::optional<T>::get_value_or(sprout::move(x), static_cast<typename sprout::optional<T>::rvalue_reference_type>(v));
}
template<typename T>
inline SPROUT_CONSTEXPR typename sprout::optional<T>::reference_const_type
get_value_or(sprout::optional<T> const& x, typename sprout::optional<T>::reference_const_type v) {
return sprout::optional<T>::get_value_or(x, v);
2012-10-22 14:10:11 +00:00
}
} // namespace sprout
#endif // #ifndef SPROUT_OPTIONAL_GET_HPP