Indiana Unversity logo[ConceptGCC]

ConceptGCC :

Associated type as return type.

From: hirohito none (hitobasira_at_[hidden])
Date: 2008-08-18 14:06:59


Following code can't be compiled with ConceptGCC 4.3.0 Alpha 7

#include <concepts>
auto concept Foo < typename T >
{
        requires std::CopyConstructible< T > ;
        typename result_type ;
        requires std::CopyAssignable< result_type, int > ;
        result_type & value( T & x ) { return x.value ; }
}

template < typename T > requires Foo< T >
void f( T x )
{ value(x) = 0 ; }

struct Bar
{ int value ; } ;

int main()
{ f(Bar()) ; }

If concept does not allow above code, how can i write following C++03
code with concept?

template < typename T >
void f( T x )
{ x.value = 0 ; }