Indiana Unversity logo[ConceptGCC]

ConceptGCC :

Re: Requiring a function template specialization

From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2007-06-06 20:22:42


On Jun 6, 2007, at 4:36 PM, Walter E Brown wrote:

> I would like to express a concept, Foo<T>, that requires the existence
> of a specialization, foo<T>, of a function template.
>
> I tried the following with conceptgcc-boostcon under Cygwin, but
> got an
> ICE (I submitted a bug report earlier today):
>
> #include <concepts>
>
> concept Foo< class T >
> {
> template<>
> T
> foo<T>();
> };
>
> Is the above the correct way to express the desired concept? Thanks,

A template specialization has to specialize something. In this case,
there is no primary template to be specialized. One thing you can do
is write this:

        concept Foo<class T> {
          T foo();
        }

You can call it as just "foo()", or (to be more specific), Foo<T>::foo
().

        - Doug