This is a followup to r194536, which changed the pair copy constructor to be
trivial in C++03, thus making it trivial in both C++03 and C++11. This patch allows one to opt-in/out of this decision with a macro. You can choose to have the pair copy constructor always be trivial, or always be non-trivial. The flag controlling this is now _LIBCPP_TRIVIAL_PAIR_COPY_CTOR. The client can define this flag to 1, and the pair copy constructor will be trivial (when possible of course), or to 0, and the pair copy constructor will be nontrivial. Default settings for this flag are set in <__config> (as usual). With this commit the default is _LIBCPP_TRIVIAL_PAIR_COPY_CTOR=1 for all platforms except __APPLE__, which defaults to _LIBCPP_TRIVIAL_PAIR_COPY_CTOR=0. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@194742 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0c6a583e2a
commit
65173fee34
@ -567,6 +567,16 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define _LIBCPP_WCTYPE_IS_MASK
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_STD_VER
|
||||
# if __cplusplus <= 201103L
|
||||
# define _LIBCPP_STD_VER 11
|
||||
|
@ -272,10 +272,10 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
|
||||
)
|
||||
: first(__p.first), second(__p.second) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(const pair& __p) = default;
|
||||
#elif !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) // default the copy ctor in C++03
|
||||
#elif !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) || !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(const pair& __p)
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user