• Home
  • Raw
  • Download

Lines Matching refs:T

114 	template <typename T>
115 using is_trivially_destructible = std::has_trivial_destructor<T>;
131 template <class T>
134 constexpr static bool value = std::is_nothrow_constructible<T, T&&>::value;
138 template <class T, class U>
148 constexpr static bool value = has_assign<T, U>(true);
152 template <class T>
165 constexpr static bool value = has_nothrow_move_assign<T, is_assignable<T&, T&&>::value>::value;
175 template <class T> class optional;
178 template <class T> class optional<T&>;
182 template <class T> inline constexpr T&& constexpr_forward(typename std::remove_reference<T>::type& … in constexpr_forward()
184 return static_cast<T&&>(t); in constexpr_forward()
187 template <class T> inline constexpr T&& constexpr_forward(typename std::remove_reference<T>::type&&… in constexpr_forward()
189 static_assert(!std::is_lvalue_reference<T>::value, "!!"); in constexpr_forward()
190 return static_cast<T&&>(t); in constexpr_forward()
193 template <class T> inline constexpr typename std::remove_reference<T>::type&& constexpr_move(T&& t)… in constexpr_move()
195 return static_cast<typename std::remove_reference<T>::type&&>(t); in constexpr_move()
210 template <typename T>
219 constexpr static bool value = has_overload<T>(true);
222 template <typename T, TR2_OPTIONAL_REQUIRES(!has_overloaded_addressof<T>)>
223 constexpr T* static_addressof(T& ref) in static_addressof()
228 template <typename T, TR2_OPTIONAL_REQUIRES(has_overloaded_addressof<T>)>
229 T* static_addressof(T& ref) in static_addressof()
266 template <class T>
270 T value_;
281 template <class T>
285 T value_;
296 template <class T>
300 storage_t<T> storage_;
304 explicit constexpr optional_base(const T& v) : init_(true), storage_(v) {} in optional_base()
306 explicit constexpr optional_base(T&& v) : init_(true), storage_(constexpr_move(v)) {} in optional_base()
311 …template <class U, class... Args, TR2_OPTIONAL_REQUIRES(is_constructible<T, std::initializer_list<…
315 ~optional_base() { if (init_) storage_.value_.T::~T(); } in ~optional_base()
319 template <class T>
323 constexpr_storage_t<T> storage_;
327 explicit constexpr constexpr_optional_base(const T& v) : init_(true), storage_(v) {} in constexpr_optional_base()
329 explicit constexpr constexpr_optional_base(T&& v) : init_(true), storage_(constexpr_move(v)) {} in constexpr_optional_base()
334 …template <class U, class... Args, TR2_OPTIONAL_REQUIRES(is_constructible<T, std::initializer_list<…
341 template <class T>
343 is_trivially_destructible<T>::value,
344 constexpr_optional_base<T>,
345 optional_base<T>
350 template <class T>
351 class optional : private OptionalBase<T>
353 static_assert( !std::is_same<typename std::decay<T>::type, nullopt_t>::value, "bad T" );
354 static_assert( !std::is_same<typename std::decay<T>::type, in_place_t>::value, "bad T" );
357 constexpr bool initialized() const noexcept { return OptionalBase<T>::init_; } in initialized()
358 T* dataptr() { return std::addressof(OptionalBase<T>::storage_.value_); } in dataptr()
359 …constexpr const T* dataptr() const { return detail_::static_addressof(OptionalBase<T>::storage_.va… in dataptr()
362 constexpr const T& contained_val() const& { return OptionalBase<T>::storage_.value_; } in contained_val()
364 …OPTIONAL_MUTABLE_CONSTEXPR T&& contained_val() && { return std::move(OptionalBase<T>::storage_.val… in contained_val()
365 OPTIONAL_MUTABLE_CONSTEXPR T& contained_val() & { return OptionalBase<T>::storage_.value_; } in contained_val()
367 T& contained_val() & { return OptionalBase<T>::storage_.value_; } in contained_val()
368 T&& contained_val() && { return std::move(OptionalBase<T>::storage_.value_); } in contained_val()
371 constexpr const T& contained_val() const { return OptionalBase<T>::storage_.value_; } in contained_val()
372 T& contained_val() { return OptionalBase<T>::storage_.value_; } in contained_val()
376 if (initialized()) dataptr()->T::~T(); in clear()
377 OptionalBase<T>::init_ = false; in clear()
381 void initialize(Args&&... args) noexcept(noexcept(T(std::forward<Args>(args)...))) in initialize()
383 assert(!OptionalBase<T>::init_); in initialize()
384 ::new (static_cast<void*>(dataptr())) T(std::forward<Args>(args)...); in initialize()
385 OptionalBase<T>::init_ = true; in initialize()
389 …void initialize(std::initializer_list<U> il, Args&&... args) noexcept(noexcept(T(il, std::forward<… in initialize()
391 assert(!OptionalBase<T>::init_); in initialize()
392 ::new (static_cast<void*>(dataptr())) T(il, std::forward<Args>(args)...); in initialize()
393 OptionalBase<T>::init_ = true; in initialize()
397 typedef T value_type;
400 constexpr optional() noexcept : OptionalBase<T>() {}; in optional()
401 constexpr optional(nullopt_t) noexcept : OptionalBase<T>() {}; in optional()
404 : OptionalBase<T>() in optional()
407 ::new (static_cast<void*>(dataptr())) T(*rhs); in optional()
408 OptionalBase<T>::init_ = true; in optional()
412 optional(optional&& rhs) noexcept(is_nothrow_move_constructible<T>::value) in optional()
413 : OptionalBase<T>() in optional()
416 ::new (static_cast<void*>(dataptr())) T(std::move(*rhs)); in optional()
417 OptionalBase<T>::init_ = true; in optional()
421 constexpr optional(const T& v) : OptionalBase<T>(v) {} in optional()
423 constexpr optional(T&& v) : OptionalBase<T>(constexpr_move(v)) {} in optional()
427 : OptionalBase<T>(in_place_t{}, constexpr_forward<Args>(args)...) {} in optional()
429 …template <class U, class... Args, TR2_OPTIONAL_REQUIRES(is_constructible<T, std::initializer_list<…
431 : OptionalBase<T>(in_place_t{}, il, constexpr_forward<Args>(args)...) {} in optional()
452 noexcept(is_nothrow_move_assignable<T>::value && is_nothrow_move_constructible<T>::value) in operator =()
464 is_same<typename decay<U>::type, T>::value, in operator =()
489 …void swap(optional<T>& rhs) noexcept(is_nothrow_move_constructible<T>::value && noexcept(swap(decl… in swap()
500 constexpr T const* operator ->() const { in operator ->()
506 OPTIONAL_MUTABLE_CONSTEXPR T* operator ->() { in operator ->()
511 constexpr T const& operator *() const& { in operator *()
515 OPTIONAL_MUTABLE_CONSTEXPR T& operator *() & { in operator *()
520 OPTIONAL_MUTABLE_CONSTEXPR T&& operator *() && { in operator *()
525 constexpr T const& value() const& { in value()
529 OPTIONAL_MUTABLE_CONSTEXPR T& value() & { in value()
533 OPTIONAL_MUTABLE_CONSTEXPR T&& value() && { in value()
540 T* operator ->() { in operator ->()
545 constexpr T const& operator *() const { in operator *()
549 T& operator *() { in operator *()
554 constexpr T const& value() const { in value()
558 T& value() { in value()
567 constexpr T value_or(V&& v) const& in value_or()
569 return *this ? **this : detail_::convert<T>(constexpr_forward<V>(v)); in value_or()
575 OPTIONAL_MUTABLE_CONSTEXPR T value_or(V&& v) && in value_or()
577 …return *this ? constexpr_move(const_cast<optional<T>&>(*this).contained_val()) : detail_::convert< in value_or()
583 T value_or(V&& v) && in value_or()
585 …return *this ? constexpr_move(const_cast<optional<T>&>(*this).contained_val()) : detail_::convert< in value_or()
593 constexpr T value_or(V&& v) const in value_or()
595 return *this ? **this : detail_::convert<T>(constexpr_forward<V>(v)); in value_or()
603 template <class T>
604 class optional<T&>
606 static_assert( !std::is_same<T, nullopt_t>::value, "bad T" );
607 static_assert( !std::is_same<T, in_place_t>::value, "bad T" );
608 T* ref;
617 constexpr optional(T& v) noexcept : ref(detail_::static_addressof(v)) {} in optional()
619 optional(T&&) = delete;
623 explicit constexpr optional(in_place_t, T& v) noexcept : ref(detail_::static_addressof(v)) {} in optional()
625 explicit optional(in_place_t, T&&) = delete;
649 is_same<typename decay<U>::type, optional<T&>>::value, in operator =()
661 !is_same<typename decay<U>::type, optional<T&>>::value,
666 void emplace(T& v) noexcept { in emplace()
670 void emplace(T&&) = delete;
673 void swap(optional<T&>& rhs) noexcept in swap()
679 constexpr T* operator->() const { in operator ->()
683 constexpr T& operator*() const { in operator *()
687 constexpr T& value() const { in value()
696 constexpr typename decay<T>::type value_or(V&& v) const in value_or()
698 return *this ? **this : detail_::convert<typename decay<T>::type>(constexpr_forward<V>(v)); in value_or()
703 template <class T>
704 class optional<T&&>
706 static_assert( sizeof(T) == 0, "optional rvalue references disallowed" );
711 template <class T> constexpr bool operator==(const optional<T>& x, const optional<T>& y) in operator ==()
716 template <class T> constexpr bool operator!=(const optional<T>& x, const optional<T>& y) in operator !=()
721 template <class T> constexpr bool operator<(const optional<T>& x, const optional<T>& y) in operator <()
726 template <class T> constexpr bool operator>(const optional<T>& x, const optional<T>& y) in operator >()
731 template <class T> constexpr bool operator<=(const optional<T>& x, const optional<T>& y) in operator <=()
736 template <class T> constexpr bool operator>=(const optional<T>& x, const optional<T>& y) in operator >=()
743 template <class T> constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept in operator ==()
748 template <class T> constexpr bool operator==(nullopt_t, const optional<T>& x) noexcept in operator ==()
753 template <class T> constexpr bool operator!=(const optional<T>& x, nullopt_t) noexcept in operator !=()
758 template <class T> constexpr bool operator!=(nullopt_t, const optional<T>& x) noexcept in operator !=()
763 template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept in operator <() argument
768 template <class T> constexpr bool operator<(nullopt_t, const optional<T>& x) noexcept in operator <()
773 template <class T> constexpr bool operator<=(const optional<T>& x, nullopt_t) noexcept in operator <=()
778 template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept in operator <=() argument
783 template <class T> constexpr bool operator>(const optional<T>& x, nullopt_t) noexcept in operator >()
788 template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept in operator >() argument
793 template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept in operator >=() argument
798 template <class T> constexpr bool operator>=(nullopt_t, const optional<T>& x) noexcept in operator >=()
806 template <class T> constexpr bool operator==(const optional<T>& x, const T& v) in operator ==()
811 template <class T> constexpr bool operator==(const T& v, const optional<T>& x) in operator ==()
816 template <class T> constexpr bool operator!=(const optional<T>& x, const T& v) in operator !=()
821 template <class T> constexpr bool operator!=(const T& v, const optional<T>& x) in operator !=()
826 template <class T> constexpr bool operator<(const optional<T>& x, const T& v) in operator <()
831 template <class T> constexpr bool operator>(const T& v, const optional<T>& x) in operator >()
836 template <class T> constexpr bool operator>(const optional<T>& x, const T& v) in operator >()
841 template <class T> constexpr bool operator<(const T& v, const optional<T>& x) in operator <()
846 template <class T> constexpr bool operator>=(const optional<T>& x, const T& v) in operator >=()
851 template <class T> constexpr bool operator<=(const T& v, const optional<T>& x) in operator <=()
856 template <class T> constexpr bool operator<=(const optional<T>& x, const T& v) in operator <=()
861 template <class T> constexpr bool operator>=(const T& v, const optional<T>& x) in operator >=()
868 template <class T> constexpr bool operator==(const optional<T&>& x, const T& v) in operator ==()
873 template <class T> constexpr bool operator==(const T& v, const optional<T&>& x) in operator ==()
878 template <class T> constexpr bool operator!=(const optional<T&>& x, const T& v) in operator !=()
883 template <class T> constexpr bool operator!=(const T& v, const optional<T&>& x) in operator !=()
888 template <class T> constexpr bool operator<(const optional<T&>& x, const T& v) in operator <()
893 template <class T> constexpr bool operator>(const T& v, const optional<T&>& x) in operator >()
898 template <class T> constexpr bool operator>(const optional<T&>& x, const T& v) in operator >()
903 template <class T> constexpr bool operator<(const T& v, const optional<T&>& x) in operator <()
908 template <class T> constexpr bool operator>=(const optional<T&>& x, const T& v) in operator >=()
913 template <class T> constexpr bool operator<=(const T& v, const optional<T&>& x) in operator <=()
918 template <class T> constexpr bool operator<=(const optional<T&>& x, const T& v) in operator <=()
923 template <class T> constexpr bool operator>=(const T& v, const optional<T&>& x) in operator >=()
929 template <class T> constexpr bool operator==(const optional<const T&>& x, const T& v) in operator ==()
934 template <class T> constexpr bool operator==(const T& v, const optional<const T&>& x) in operator ==()
939 template <class T> constexpr bool operator!=(const optional<const T&>& x, const T& v) in operator !=()
944 template <class T> constexpr bool operator!=(const T& v, const optional<const T&>& x) in operator !=()
949 template <class T> constexpr bool operator<(const optional<const T&>& x, const T& v) in operator <()
954 template <class T> constexpr bool operator>(const T& v, const optional<const T&>& x) in operator >()
959 template <class T> constexpr bool operator>(const optional<const T&>& x, const T& v) in operator >()
964 template <class T> constexpr bool operator<(const T& v, const optional<const T&>& x) in operator <()
969 template <class T> constexpr bool operator>=(const optional<const T&>& x, const T& v) in operator >=()
974 template <class T> constexpr bool operator<=(const T& v, const optional<const T&>& x) in operator <=()
979 template <class T> constexpr bool operator<=(const optional<const T&>& x, const T& v) in operator <=()
984 template <class T> constexpr bool operator>=(const T& v, const optional<const T&>& x) in operator >=()
991 template <class T>
992 void swap(optional<T>& x, optional<T>& y) noexcept(noexcept(x.swap(y))) in swap()
998 template <class T>
999 constexpr optional<typename decay<T>::type> make_optional(T&& v) in make_optional()
1001 return optional<typename decay<T>::type>(constexpr_forward<T>(v)); in make_optional()
1016 template <typename T>
1017 struct hash<std::experimental::optional<T>>
1019 typedef typename hash<T>::result_type result_type;
1020 typedef std::experimental::optional<T> argument_type;
1023 return arg ? std::hash<T>{}(*arg) : result_type{}; in operator ()()
1027 template <typename T>
1028 struct hash<std::experimental::optional<T&>>
1030 typedef typename hash<T>::result_type result_type;
1031 typedef std::experimental::optional<T&> argument_type;
1034 return arg ? std::hash<T>{}(*arg) : result_type{}; in operator ()()