Re: [Boost-bugs] [Boost C++ Libraries] #13012: boost::has_equal_to fails with captureless lambda expression types

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #13012: boost::has_equal_to fails with captureless lambda expression types
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-02-10 11:56:16


#13012: boost::has_equal_to fails with captureless lambda expression types
------------------------------------+--------------------------
  Reporter: Joaquín M López Muñoz | Owner: John Maddock
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: type_traits
   Version: Boost 1.63.0 | Severity: Problem
Resolution: fixed | Keywords:
------------------------------------+--------------------------
Changes (by John Maddock):

 * status: new => closed
 * resolution: => fixed

Comment:

 This is a somewhat documented issue, the example in the docs is:

 {{{
 struct A { };
 void operator==(const A&, const A&);
 struct B { operator A(); };
 boost::has_equal_to<A>::value; // this is fine
 boost::has_equal_to<B>::value; // error: ambiguous overload
 }}}

 A similar situation occurs with a captureless lambda, because `f` in your
 example above is really a class that looks like:

 {{{
 struct some_obscure_name
 {
    operator void (*)()()const;
 };
 }}}

 However, it turns out that in C++11 we can do better, for modern compilers
 this is fixed in the sequence of commits in:
 https://github.com/boostorg/type_traits/pull/64

 Note that I still have to update the docs.

 Also note that whether a lambda is comparable to other lambdas is compiler
 specific: it is for gcc (via unambiguous conversion to function pointer),
 but not for msvc which has implicit conversions to 2 different function
 pointer types and is therefore ambiguous. So the new code reports `true`
 for gcc and `false` for msvc.

-- 
Ticket URL: <https://svn.boost.org/trac10/ticket/13012#comment:1>
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 : 2018-02-10 12:00:06 UTC