6#include <bond/core/config.h>
8#include <boost/core/ref.hpp>
9#include <boost/optional.hpp>
10#include <boost/utility/enable_if.hpp>
15namespace bond {
namespace ext {
namespace detail
22 template <
typename U = T,
typename boost::enable_if<std::is_constructible<T, U&&>>::type* =
nullptr>
24 : _value{ std::forward<U>(value) },
39 : _value{ other._value },
40 _ref{ _value ? std::ref(*_value) : other._ref }
45 _value = other._value;
46 _ref = _value ? std::ref(*_value) : other._ref;
50 T& get()
const BOND_NOEXCEPT
59 boost::optional<T> _value;
60 std::reference_wrapper<T> _ref;
72 value_or_reference(std::reference_wrapper<T> ref) BOND_NOEXCEPT
73 : value_or_reference{ ref.get() }
76 value_or_reference(boost::reference_wrapper<T> ref) BOND_NOEXCEPT
77 : value_or_reference{ ref.get() }
80 T& get() const BOND_NOEXCEPT
86 std::reference_wrapper<T> _ref;
Helper type that can hold either a value or a reference.
Definition: value_or_reference.h:20
namespace bond
Definition: apply.h:17