[ConceptGCC] |
ConceptGCC :Re: Addable |
From: Martin Sebor (sebor_at_[hidden])
Date: 2007-03-08 14:50:53
Christopher Eltschka wrote:
> Martin Sebor wrote:
>> Jaakko Jarvi wrote:
>>> Yes, it is normal behavior.
>>> The operator+(foo, foo) is only in scope constrained with Addable<foo>.
>>> The following should work (assuming your concept_map Addable<foo>):
>>>
>>> template <Addable T>
>>> void bar(T t) { t + t; }
>> Is it possible to call the same operator+ from a non-template?
>> Assume I can't change the concept map.
>
> The following seems to work:
>
> foo a, b;
> foo c = std::Addable<foo>::operator+(a, b);
Okay, thanks.
I don't think it's part of the proposal but I think it might
be useful to make it possible to use the same syntax in
non-template code as within templates. Maybe via a using
declaration or directive:
int main () {
foo a, b;
using std::Addable<foo>::operator+;
// or using std::Addable<foo> to get all signatures
foo c = a + b;
}
Has this been considered and would it be feasible?
Martin