Common concepts#
Note
Generic functions and classes in mp++ support concepts to constrain the types with which they can be used. C++ concepts are part of the C++20 standard, and they are currently available only on GCC>=6, Clang>=10 and MSVC>=16.3. When used with compilers which do not support concepts natively, mp++ will employ a concept emulation layer in order to provide the same functionality as native C++ concepts.
Since the syntax of native C++ concepts is clearer than that of the concept emulation layer, the mp++ documentation describes and refers to concepts in their native C++ form.
#include <mp++/concepts.hpp>
-
template<typename T>
concept mppp::cpp_integral# This concept is satisfied if
Tis an integral C++ type.The GCC-style extended 128-bit integral types
__int128_tand__uint128_tare included as well, if supported on the current platform/compiler combination (see also theMPPP_HAVE_GCC_INT128definition).
-
template<typename T>
concept mppp::cpp_unsigned_integral# This concept is satisfied if
Tis an unsignedcpp_integral.
-
template<typename T>
concept mppp::cpp_signed_integral# This concept is satisfied if
Tis a signedcpp_integral.
-
template<typename T>
concept mppp::cpp_floating_point# This concept is satisfied if
Tis a floating-point C++ type.
-
template<typename T>
concept mppp::cpp_arithmetic# This concept is satisfied if
Tis either acpp_integralor acpp_floating_pointtype.
-
template<typename T>
concept mppp::cpp_complex# This concept is satisfied if
Tis one of the standard complex C++ types:std::complex<float>,std::complex<double>,std::complex<long double>.
-
template<typename T>
concept mppp::string_type# This concept is satisfied by C++ string-like types. Specifically, the concept will be true if
T, after the removal of cv qualifiers, is one of the following types:std::string,a pointer to (possibly cv qualified)
char,a
chararray of any size.
Additionally, if at least C++17 is being used, the concept is satisfied also by
std::string_view(see also theMPPP_HAVE_STRING_VIEWdefinition).