// // traits.hpp // stream // // Created by Sam Jaffe on 6/24/17. // #pragma once namespace stream { namespace detail { template struct ref_or_val { ref_or_val operator=(T && val) { value = std::move(val); return *this; } operator T const &() const { return value; } T value; }; template struct ref_or_val { ref_or_val operator=(T & val) { value = &val; return *this; } operator T &() const { return *value; } T * value; }; } } namespace stream { namespace detail { template struct map_member_object; template struct map_member_object { using type = R const &; type operator()(T const & val) const { return val.*mem; } R T::*mem; }; template struct map_member_function; template struct map_member_function { using type = R; type operator()(T const & val) const { return (val.*mem)(); } R (T::* mem)() const; }; }} namespace stream { namespace detail { template struct is_dereferencable : public std::false_type {}; template <> struct is_dereferencable : public std::false_type {}; template struct is_dereferencable())>::value>::type> : public std::true_type {}; }}