Attempt to work around Visual C++ initializer list overload bug.

I'm hoping that these templated initializer lists will be considered a better
overload than the others. I have no idea if it will actually work, this is a
real shot in the dark.

The enable_if checks should probably be for implicit conversion, there might
be a chance this could override a valid call when there's an explicit
conversion.

[SVN r86419]
This commit is contained in:
Daniel James
2013-10-24 18:11:35 +00:00
parent 3922d1bb63
commit b4d62e4670
3 changed files with 87 additions and 0 deletions

View File

@@ -22,6 +22,10 @@
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list>
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1800))
#include <boost/type_traits/is_convertible.hpp>
#endif
#endif
#if defined(BOOST_MSVC)
@@ -402,6 +406,16 @@ namespace unordered
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
void insert(std::initializer_list<value_type>);
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1800))
template <typename T>
typename boost::enable_if_c<
boost::is_convertible<T, value_type>::value,
void>::type insert(std::initializer_list<T> list)
{
table_.insert_range(list.begin(), list.end());
}
#endif
#endif
iterator erase(const_iterator);
@@ -872,6 +886,16 @@ namespace unordered
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
void insert(std::initializer_list<value_type>);
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1800))
template <typename T>
typename boost::enable_if_c<
boost::is_convertible<T, value_type>::value,
void>::type insert(std::initializer_list<T> list)
{
table_.insert_range(list.begin(), list.end());
}
#endif
#endif
iterator erase(const_iterator);