Add constexpr to size_max() methods for C++11

pull/131/merge
Jeffrey Walton 2016-09-04 02:29:32 -04:00
parent f23314f731
commit fea45591b2
1 changed files with 16 additions and 16 deletions

View File

@ -52,7 +52,7 @@ public:
//! because the latter is \a not a \a constexpr. Some compilers, like Clang, do not //! because the latter is \a not a \a constexpr. Some compilers, like Clang, do not
//! optimize it well under all circumstances. Compilers like GCC, ICC and MSVC appear //! optimize it well under all circumstances. Compilers like GCC, ICC and MSVC appear
//! to optimize it well in either form. //! to optimize it well in either form.
size_type max_size() const {return (SIZE_MAX/sizeof(T));} CRYPTOPP_CONSTEXPR size_type max_size() const {return (SIZE_MAX/sizeof(T));}
#if defined(CRYPTOPP_CXX11_VARIADIC_TEMPLATES) || defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_CXX11_VARIADIC_TEMPLATES) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
@ -278,7 +278,7 @@ public:
assert(false); assert(false);
} }
size_type max_size() const {return 0;} CRYPTOPP_CONSTEXPR size_type max_size() const {return 0;}
//LCOV_EXCL_STOP //LCOV_EXCL_STOP
}; };
@ -410,7 +410,7 @@ public:
return newPointer; return newPointer;
} }
size_type max_size() const {return STDMAX(m_fallbackAllocator.max_size(), S);} CRYPTOPP_CONSTEXPR size_type max_size() const {return STDMAX(m_fallbackAllocator.max_size(), S);}
private: private: