Created on Oct 26, 2024
Think of a trait as a small object whose main purpose is to carry information used by another object or algorithm to determine "policy" or "implementation details".
- Bjarne Stroustrup (link)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Type traits are an intelligency skill of c++ template metaprogramming that give you the ability to inspect, fetch, transform and use the properties (traits) of types.
static_assert(std::is_floating_point<std::float16_t>::value); static_assert(std::is_floating_point_v<std::float16_t>); std::cout << std::boolalpha << std::is_floating_point_v<std::float16_t> << std::endl; // true
static_assert( ! std::is_floating_point_v<std::string>); std::cout << std::boolalpha << std::is_floating_point_v<std::string> << std::endl; // false
c++ std::exception:
std::cout.write(err.data(), err.size());
std::cout << std::endl;
caught:
================================================== # The c++ programming language. # # # # Home: cppfx.xyz # # E # # Deck # ==================================================