diff --git a/config.h b/config.h index 7d8bda34..8ff3bcb9 100644 --- a/config.h +++ b/config.h @@ -485,4 +485,42 @@ NAMESPACE_END #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS #endif +// ***************** C++11 related ******************** + +// Visual Studio and C++11 language features began at Visual Studio 2012, +// https://msdn.microsoft.com/en-us/library/hh567368%28v=vs.110%29.aspx. +// Also see the warning on the buggy C++11 feature matrix at +// http://stackoverflow.com/a/31642496/608639 +#if (__cpluplus >= 201103L) || (_MSC_VER >= 1500) +# define CRYPTOPP_CXX11 +#endif + +// C++11 R-values. MS at VS2010 (16.00); GCC at 4.3; Clang at 2.9; and Intel 11.1. +#if (_MSC_VER >= 1600) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) +# define CRYPTOPP_CXX11_RVALUES 1 +#endif +#if defined(__clang__) +# if __has_feature(cxx_rvalue_references) +# define CRYPTOPP_CXX11_RVALUES 1 +# endif +#endif // R-value compilers + +// C++11 noexcept. MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; and Intel 14.0. +#if (_MSC_VER >= 1900) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +# define CRYPTOPP_CXX11_NOEXCEPT 1 +#endif +#if defined(__clang__) +# if __has_feature(cxx_noexcept) +# define CRYPTOPP_CXX11_NOEXCEPT 1 +# endif +#endif // noexcept compilers + +#if defined(CRYPTOPP_CXX11_NOEXCEPT) +# define CRYPTOPP_THROW noexcept(false) +# define CRYPTOPP_NO_THROW noexcept(true) +#else +# define CRYPTOPP_THROW +# define CRYPTOPP_NO_THROW +#endif // CRYPTOPP_CXX11_NOEXCEPT + #endif