Earlier quoted context omitted.
Epochs would be more usable. Nobody can afford to litter their code with hundreds of feature tests. API changes that change semantics are forbidden in Standard interfaces, although APIs can be extended, backward-compatibly. To make an actual change, we need to introduce a new name. Thus, when we get around to modernizing std::vector, the fixed version will have a different name, maybe std::vec, but conceivably std2::…
> I don't know of any plans for feature test macro analogs that would integrate with modules. What is the plan, if any, for deciding at compile time whether the format module is available or if I would still have to use fmtlib/fmt?
C++20 Concepts: The Definitive Guide
101–102 of 102 posts
Re: C++20 Concepts: The Definitive Guide
#102Earlier quoted context omitted.
Rust traits are opt-in, C++ concepts are opt-out; you can think of C++ concepts as having a "blanket" implementation for all types, so you'd need to opt out using negative reasoning. For example, in C++, you can declare a trait: template struct totally_ordered : std::false_type {}; and opt-in implement it for some types, but not for floats. Then you can define a TotallyOrdered concept that requires the trait. The C++…
I think this might have been a better way to explain it than my attempt (since it looks like that confused some readers). However, you say C++ concepts are "opt-out", how does a Class opt out ? If your Delicious concept mistakenly applies to my Desert, how do I as the author of the Desert tell C++ "No, no, when people ask if a Desert is Delicious tell them it isn't?".
There is no way for a class to both implement the concept API and opt-out. The only way to support it is for the C++ concept writer to make their concept opt-in.