Indiana Unversity logo[ConceptGCC]

ConceptGCC :

Re: Splitting out implementations?

From: Douglas Gregor (dgregor_at_[hidden])
Date: 2007-11-20 11:09:08


Ciaran McCreesh wrote:
> I'm fairly sure I'm missing something obvious here...
>

I think it's the compiler that is missing something obvious :)
> #include <concepts>
> #include <iterator>
>
> template <typename T_>
> requires std::ForwardIterator<T_>
> struct F
> {
> F();
> };
>
> template <typename T_>
> requires std::ForwardIterator<T_>
> F<T_>::F()
> {
> }
>
> gives:
>
> a.cc:14: error: invalid use of incomplete type ‘struct F<T_>’
> a.cc:8: error: declaration of ‘struct F<T_>’
> a.cc:14: error: template definition of non-template ‘F<T_>::F()’
> And
>
> template <typename T_>
> F<T_>::F()
> {
> }
>
> gives:
>
> a.cc:13: error: new declaration ‘F<T_>::F()’
> a.cc:9: error: ambiguates old declaration ‘F<T_>::F()’
>
> What's the correct way of splitting out the implementation?
>
The first one is the correct version.

    - Doug