C++20 Concepts: The Definitive Guide
thecodepad.com
C++20 Concepts: The Definitive Guide
1–10 of 102 posts
Re: C++20 Concepts: The Definitive Guide
#2 test.cpp: In instantiation of ‘T add(T, T) [with T = std::basic_string]’:
test.cpp:17:21: required from here
test.cpp:11:22: error: static assertion failed
11 | static_assert(std::is_integral_v);
| ~~~~~^~~~~~~~~~~~~~~~
test.cpp:11:22: note: ‘std::is_integral_v >’ evaluates to false
Build finished with error(s).Re: C++20 Concepts: The Definitive Guide
#3Is it just me, or have C++ errors gotten a lot better? Below example from guide seems a lot more ergonomic than in years past. test.cpp: In instantiation of ‘T add(T, T) [with T = std::basic_string ]’: test.cpp:17:21: required from here test.cpp:11:22: error: static assertion failed 11 | static_assert(std::is_integral_v ); | ~~~~~^~~~~~~~~~~~~~~~ test.cpp:11:22: note: ‘std::is_integral_v >’ evaluates to false Build f…
Re: C++20 Concepts: The Definitive Guide
#4Is it just me, or have C++ errors gotten a lot better? Below example from guide seems a lot more ergonomic than in years past. test.cpp: In instantiation of ‘T add(T, T) [with T = std::basic_string ]’: test.cpp:17:21: required from here test.cpp:11:22: error: static assertion failed 11 | static_assert(std::is_integral_v ); | ~~~~~^~~~~~~~~~~~~~~~ test.cpp:11:22: note: ‘std::is_integral_v >’ evaluates to false Build f…
I agree this is great news. I actually had to write MS SQL for the first time last week and it was disappointing but sadly expected to have it respond to a common but not technically-standard SQL syntax I'm used to with "Syntax error" as though somehow that's helpful. Such poor errors meant I spent more time reading the documentation than writing queries even though I've years of experience across several other SQL dialects.
Re: C++20 Concepts: The Definitive Guide
#5Is it just me, or have C++ errors gotten a lot better? Below example from guide seems a lot more ergonomic than in years past. test.cpp: In instantiation of ‘T add(T, T) [with T = std::basic_string ]’: test.cpp:17:21: required from here test.cpp:11:22: error: static assertion failed 11 | static_assert(std::is_integral_v ); | ~~~~~^~~~~~~~~~~~~~~~ test.cpp:11:22: note: ‘std::is_integral_v >’ evaluates to false Build f…
Re: C++20 Concepts: The Definitive Guide
#6Is it just me, or have C++ errors gotten a lot better? Below example from guide seems a lot more ergonomic than in years past. test.cpp: In instantiation of ‘T add(T, T) [with T = std::basic_string ]’: test.cpp:17:21: required from here test.cpp:11:22: error: static assertion failed 11 | static_assert(std::is_integral_v ); | ~~~~~^~~~~~~~~~~~~~~~ test.cpp:11:22: note: ‘std::is_integral_v >’ evaluates to false Build f…
Re: C++20 Concepts: The Definitive Guide
#7I mean sure you can extend any commutative group into a module over the integers but you probably don't want to make this a hard requirement just to have subtraction.
Re: C++20 Concepts: The Definitive Guide
#8Re: C++20 Concepts: The Definitive Guide
#9Is it just me, or have C++ errors gotten a lot better? Below example from guide seems a lot more ergonomic than in years past. test.cpp: In instantiation of ‘T add(T, T) [with T = std::basic_string ]’: test.cpp:17:21: required from here test.cpp:11:22: error: static assertion failed 11 | static_assert(std::is_integral_v ); | ~~~~~^~~~~~~~~~~~~~~~ test.cpp:11:22: note: ‘std::is_integral_v >’ evaluates to false Build f…
One of the major motivations for concepts is to allow better error messages.
Re: C++20 Concepts: The Definitive Guide
#10Is it just me, or have C++ errors gotten a lot better? Below example from guide seems a lot more ergonomic than in years past. test.cpp: In instantiation of ‘T add(T, T) [with T = std::basic_string ]’: test.cpp:17:21: required from here test.cpp:11:22: error: static assertion failed 11 | static_assert(std::is_integral_v ); | ~~~~~^~~~~~~~~~~~~~~~ test.cpp:11:22: note: ‘std::is_integral_v >’ evaluates to false Build f…
See https://clang.llvm.org/diagnostics.html ; that page is not dated, but compares to gcc 4.9, which is from April 22, 2014.
gcc also has worked on improving its error messages (most likely because of competition with clang), so that comparison probably isn’t accurate anymore.