Skip to content

Commit 9552828

Browse files
committed
Apply optimization traits also to std::pair
1 parent 7dbf9a1 commit 9552828

File tree

1 file changed

+66
-8
lines changed

1 file changed

+66
-8
lines changed

include/boost/container/detail/pair.hpp

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -548,30 +548,55 @@ struct is_class< std::pair<T1, T2> >
548548

549549

550550
//Triviality of pair
551+
552+
//
553+
// is_trivially_copy_assignable
554+
//
555+
551556
template<class T>
552-
struct is_trivially_copy_constructible;
557+
struct is_trivially_copy_assignable;
558+
559+
template<class A, class B>
560+
struct is_trivially_copy_assignable<boost::container::dtl::pair<A,B> >
561+
{
562+
BOOST_STATIC_CONSTEXPR bool value = boost::move_detail::is_trivially_copy_assignable<A>::value &&
563+
boost::move_detail::is_trivially_copy_assignable<B>::value;
564+
};
553565

554566
template<class A, class B>
555-
struct is_trivially_copy_assignable
556-
<boost::container::dtl::pair<A,B> >
567+
struct is_trivially_copy_assignable<std::pair<A,B> >
568+
: is_trivially_copy_assignable<boost::container::dtl::pair<A,B> >
557569
{
558570
BOOST_STATIC_CONSTEXPR bool value = boost::move_detail::is_trivially_copy_assignable<A>::value &&
559571
boost::move_detail::is_trivially_copy_assignable<B>::value;
560572
};
561573

574+
//
575+
// is_trivially_move_assignable
576+
//
577+
562578
template<class T>
563-
struct is_trivially_move_constructible;
579+
struct is_trivially_move_assignable;
564580

565581
template<class A, class B>
566-
struct is_trivially_move_assignable
567-
<boost::container::dtl::pair<A,B> >
582+
struct is_trivially_move_assignable<boost::container::dtl::pair<A,B> >
568583
{
569584
BOOST_STATIC_CONSTEXPR bool value = boost::move_detail::is_trivially_move_assignable<A>::value &&
570585
boost::move_detail::is_trivially_move_assignable<B>::value;
571586
};
572587

588+
template<class A, class B>
589+
struct is_trivially_move_assignable<std::pair<A,B> >
590+
: is_trivially_move_assignable<boost::container::dtl::pair<A,B> >
591+
{};
592+
593+
594+
//
595+
// is_trivially_copy_constructible
596+
//
597+
573598
template<class T>
574-
struct is_trivially_copy_assignable;
599+
struct is_trivially_copy_constructible;
575600

576601
template<class A, class B>
577602
struct is_trivially_copy_constructible<boost::container::dtl::pair<A,B> >
@@ -580,8 +605,17 @@ struct is_trivially_copy_constructible<boost::container::dtl::pair<A,B> >
580605
boost::move_detail::is_trivially_copy_constructible<B>::value;
581606
};
582607

608+
template<class A, class B>
609+
struct is_trivially_copy_constructible<std::pair<A,B> >
610+
: is_trivially_copy_constructible<boost::container::dtl::pair<A,B> >
611+
{};
612+
613+
//
614+
// is_trivially_move_constructible
615+
//
616+
583617
template<class T>
584-
struct is_trivially_move_assignable;
618+
struct is_trivially_move_constructible;
585619

586620
template<class A, class B>
587621
struct is_trivially_move_constructible<boost::container::dtl::pair<A,B> >
@@ -590,6 +624,11 @@ struct is_trivially_move_constructible<boost::container::dtl::pair<A,B> >
590624
boost::move_detail::is_trivially_move_constructible<B>::value;
591625
};
592626

627+
template<class A, class B>
628+
struct is_trivially_move_constructible<std::pair<A,B> >
629+
: is_trivially_move_constructible<boost::container::dtl::pair<A,B> >
630+
{};
631+
593632
template<class T>
594633
struct is_trivially_destructible;
595634

@@ -600,9 +639,28 @@ struct is_trivially_destructible<boost::container::dtl::pair<A,B> >
600639
boost::move_detail::is_trivially_destructible<B>::value;
601640
};
602641

642+
template<class A, class B>
643+
struct is_trivially_destructible<std::pair<A,B> >
644+
: is_trivially_destructible<boost::container::dtl::pair<A,B> >
645+
{};
603646

604647
} //namespace move_detail{
605648

649+
template<class T>
650+
struct has_trivial_destructor_after_move;
651+
652+
template<class A, class B>
653+
struct has_trivial_destructor_after_move<boost::container::dtl::pair<A,B> >
654+
{
655+
BOOST_STATIC_CONSTEXPR bool value = boost::has_trivial_destructor_after_move<A>::value &&
656+
boost::has_trivial_destructor_after_move<B>::value;
657+
};
658+
659+
template<class A, class B>
660+
struct has_trivial_destructor_after_move<std::pair<A,B> >
661+
: has_trivial_destructor_after_move<boost::container::dtl::pair<A,B> >
662+
{};
663+
606664
} //namespace boost {
607665

608666
#include <boost/container/detail/config_end.hpp>

0 commit comments

Comments
 (0)