Re: [Boost-bugs] [Boost C++ Libraries] #5419: assign fails with C++0x compilers

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5419: assign fails with C++0x compilers
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-13 00:22:57


#5419: assign fails with C++0x compilers
-------------------------------+--------------------------------------------
  Reporter: chrisj | Owner: nesotto
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: assign
   Version: Boost 1.47.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+--------------------------------------------

Comment (by Michel MORIN <mimomorin@…>):

 A patch attached. I believe it's the final patch for this problem ;)

 With this patch, the test (`libs/assign/test`) runs successfully on
 * gcc-4.3.6, gcc-4.4.6, gcc-4.5.3, gcc-4.6.1
 * clang (trunk)
 The test runs in both C++03 and C++0x modes.

 The previous patch fixes the problem of ambiguity with
 `std::initializer_list<T>`.
 However, in order to pass all the test, this is not enough.
 I added the following fixes:

 * (`boost/assign/list_of.hpp`)
   The ambiguity problem is also happened with `std::allocator<T>`.
   Adding dummy template parameter to the conversion function can avoid
 this ambiguity:
 {{{
 template
 <
     class Container
   , class Dummy1 = typename Container::difference_type
   , class Dummy2 = typename Container::iterator
>
 operator Container() const
 {
     // ...
 }
 }}}
   `std::initializer_list<T>` is SFINAE'ed out by `Dummy1` and
   `std::allocator<T>` is SFINAE'ed out by `Dummy2`.

 * (`libs/assign/test/std.cpp`)
   In C++0x mode of some compilers, the code
 {{{
 using namespace std;
 // ...
 typedef pair<string,int> tuple;
 }}}
   interact badly with `std::tuple<Args…>` and causes compiler errors.
   Simply changing the `typedef` fixes the problem:
 {{{
 using namespace std;
 // ...
 typedef pair<string,int> two;
 }}}

 * (`libs/assign/test/list_inserter.cpp`)
   In C++0x mode of gcc-4.3, `std::vector<T>` does not have
 {{{
 void push_back(const T&);
 }}}
   but it has
 {{{
 template <typename Args...>
 void push_back(Args&&...);
 }}}
   So the code
 {{{
 push_back_t push_back_func = &vector<int>::push_back;
 }}}
   should be changed to
 {{{
 push_back_t push_back_func = &vector<int>::push_back<const int&>;
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5419#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC