C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Generic code, not the API you are looking for

From: Zhihao Yuan <zy_at_[hidden]>
Date: Mon, 22 Aug 2022 00:53:46 +0000
On Sunday, August 21st, 2022 at 2:14 PM, Thiago Macieira via Std-Proposals <std-proposals_at_[hidden]> wrote:

>

> > override String for std::vector<char> {
> > using char_type = char;
> >

> > bool starts_with(this auto const &v, std::string_view s) {
> > return rg::starts_with(v, s);
> > }
> > }
>

>

> This looks suspiciously like concept maps, which were part of the pre-C++11
> concepts proposal. Remember that the one we have now is called "concepts lite"
> for a reason.
>


It looks suspiciously like concept maps
because concept map is suspiciously right!
Except being proposed at the wrong part
of the language -- template. In Carbon,
template parameters and generic parameters
simply don't interact. You can't even
constrain the former (yet), but C++
has an answer for that already.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

Received on 2022-08-22 00:53:58