Indiana Unversity logo[ConceptGCC]

ConceptGCC :

Re: Associated type as return type.

From: hirohito none (hitobasira_at_[hidden])
Date: 2008-08-19 13:56:11


>How should the compiler deduce Foo<Bar>::return_type?

So the compiler does not deduce associated types?
It just looking if there is function that satisfy given associated
function, and set its associated type which is return type of
associated function to the same type as function ?
so compiler thinks as this?

auto concept Foo< typename T >
{
    requires std::CopyConstructible< T > ;
    typename result_type ;// type i don't know it right now.
    // hmm, that type used as return type of function.
    result_type function(T x)
    // I shall not deduce result_type.
    // so this default implementation will never be used even if there
is no required function.
    { return x.value ; }
}

>I think it should work if you give the result_type a default
I tryed it. It does not work in Alpha 7. I don't know ConceptGCC is
correct or not.

and I still don't know how to write function templates with concepts
that access template parametor's member variables.