C++ Logo

std-proposals

Advanced search

Re: Forward declaration of concepts

From: Omer Rosler <omer.rosler_at_[hidden]>
Date: Sun, 21 Mar 2021 21:04:53 +0200
It does work, Thank you.
I wonder if there is a use case for forward declaration of concepts which
can't be worked around like so.

On Sun, Mar 21, 2021 at 4:54 PM Marcin Jaczewski <
marcinjaczewski86_at_[hidden]> wrote:

> But this is not a mery forward declaration but circular definition (like
> CRTP).
> This means even if we allow forward declaration it still could not
> allow recursion there.
>
> Edward in other mail said that you can forward `is_tag_impl`, if this
> will not work (compiler will throw some errors)
> then the same will be with your example.
>
> niedz., 21 mar 2021 o 15:41 Omer Rosler via Std-Proposals
> <std-proposals_at_[hidden]> napisaƂ(a):
> >
> > Is there a reason forward declaration of concepts are not allowed?
> >
> > I wanted such feature in the following snippet:
> >
> > ```c++
> > template<typename T>
> > concept tag_type;
> > //Use the concept in a template declaration, when instantiated, the
> concept definition will be avilable
> > template<template<tag_type> typename ArgsType, template<ArgsType...>
> typename Templ>
> > struct template_ {};
> > template<typename T>
> > struct is_tag_impl : std::false_type {};
> > template<template<tag_type> typename ArgsType, template<ArgsType...>
> typename Templ>
> > struct is_tag_impl<template_<ArgsType, Templ>> : std::true_type {};
> >
> > template<typename T>
> > concept tag_type = is_tag_impl<T>::value;
> >
> >
> >
> > ```
> > --
> > Std-Proposals mailing list
> > Std-Proposals_at_[hidden]
> > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2021-03-21 14:05:11