Skip to content
Permalink
Browse files

Example conversion for `optional`, using [[trivially_relocatable(bool…

…)]].
  • Loading branch information...
Quuxplusone committed Nov 19, 2018
1 parent 1282055 commit 293784a734a6bae60900b498e7ec4d152c11001a
Showing with 9 additions and 1 deletion.
  1. +8 −0 include/__config
  2. +1 −1 include/optional
@@ -1281,6 +1281,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_IS_AGGREGATE
#endif

#ifndef _LIBCPP_TRIVIALLY_RELOCATABLE
#if __has_extension(trivially_relocatable)
#define _LIBCPP_TRIVIALLY_RELOCATABLE(x) [[clang::trivially_relocatable(x)]]
#else
#define _LIBCPP_TRIVIALLY_RELOCATABLE(x)
#endif
#endif

#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
#define _LIBCPP_HAS_NO_COROUTINES
#endif
@@ -581,7 +581,7 @@ using __optional_sfinae_assign_base_t = __sfinae_assign_base<
>;

template <class _Tp>
class optional
class _LIBCPP_TRIVIALLY_RELOCATABLE(is_trivially_relocatable<_Tp>::value) optional
: private __optional_move_assign_base<_Tp>
, private __optional_sfinae_ctor_base_t<_Tp>
, private __optional_sfinae_assign_base_t<_Tp>

0 comments on commit 293784a

Please sign in to comment.
You can’t perform that action at this time.