Skip to content

Commit bae5554

Browse files
committed
Use SFINAE to avoid errors in C++03 mode and std::pair
1 parent ae221a1 commit bae5554

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/emplace_test.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <boost/container/detail/config_begin.hpp>
1616
#include <boost/container/detail/workaround.hpp>
1717
#include <boost/container/detail/mpl.hpp>
18+
#include <boost/container/detail/is_pair.hpp>
1819
#include <boost/move/utility_core.hpp>
1920
#include <boost/container/detail/type_traits.hpp>
2021
#include <boost/move/detail/launder.hpp> //adl_move_swap
@@ -101,7 +102,8 @@ enum EmplaceOptions{
101102
};
102103

103104
template<class Container>
104-
bool test_expected_container(const Container &ec, const EmplaceInt *Expected, unsigned int only_first_n, unsigned int cont_offset = 0)
105+
typename boost::container::dtl::enable_if_c< !boost::container::dtl::is_pair<typename Container::value_type>::value, bool>::type
106+
test_expected_container(const Container &ec, const EmplaceInt *Expected, unsigned int only_first_n, unsigned int cont_offset = 0)
105107
{
106108
typedef typename Container::const_iterator const_iterator;
107109
const_iterator itb(ec.begin()), ite(ec.end());
@@ -125,7 +127,8 @@ bool test_expected_container(const Container &ec, const EmplaceInt *Expected, un
125127
}
126128

127129
template<class Container>
128-
bool test_expected_container(const Container &ec, const std::pair<EmplaceInt, EmplaceInt> *Expected, unsigned int only_first_n)
130+
typename boost::container::dtl::enable_if_c<boost::container::dtl::is_pair<typename Container::value_type>::value, bool>::type
131+
test_expected_container(const Container &ec, const std::pair<EmplaceInt, EmplaceInt> *Expected, unsigned int only_first_n)
129132
{
130133
typedef typename Container::const_iterator const_iterator;
131134
const_iterator itb(ec.begin()), ite(ec.end());

0 commit comments

Comments
 (0)