Boost logo

Boost :

Subject: Re: [boost] [concept_check] addable
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-04-23 16:13:48

on Mon Apr 23 2012, lcaminiti <> wrote:

> Dave Abrahams wrote
>> Actually it checks that there exists an operator+ from T non-const
>> lvalue x T non-const lvalue to U, where U is convertible to T const&
> Got it. That works for me but I might change the T non-const lvalue to T
> const&. For curiosity, is there a way to program the concept ruling out the
> implicit conversion from U to T const&?

Sure; lots of ways. One would be to pass the result to a function like

      template <class T, class U>
      void same_type(U const&)

You can see another similar example in the first example at

Dave Abrahams
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at