Remove constexpr_min duplication.

This commit is contained in:
Andrey Semashev
2024-12-02 18:58:34 +03:00
parent fbaf2dee58
commit b774aa0d9e

View File

@ -51,12 +51,13 @@ namespace boost {
// //
// some helper functions which really should be constexpr already, but sadly aren't: // some helper functions which really should be constexpr already, but sadly aren't:
// //
#ifndef BOOST_NO_CXX14_CONSTEXPR
template <class T> template <class T>
inline constexpr T constexpr_min(T const& a, T const& b) BOOST_GCD_NOEXCEPT(T) inline BOOST_CONSTEXPR T constexpr_min(T const& a, T const& b) BOOST_GCD_NOEXCEPT(T)
{ {
return a < b ? a : b; return a < b ? a : b;
} }
#ifndef BOOST_NO_CXX14_CONSTEXPR
template <class T> template <class T>
inline constexpr auto constexpr_swap(T& a, T& b) BOOST_GCD_NOEXCEPT(T) -> decltype(a.swap(b)) inline constexpr auto constexpr_swap(T& a, T& b) BOOST_GCD_NOEXCEPT(T) -> decltype(a.swap(b))
{ {
@ -70,11 +71,6 @@ namespace boost {
b = static_cast<T&&>(t); b = static_cast<T&&>(t);
} }
#else #else
template <class T>
inline T constexpr_min(T const& a, T const& b) BOOST_GCD_NOEXCEPT(T)
{
return a < b ? a : b;
}
template <class T> template <class T>
inline void constexpr_swap(T& a, T& b) BOOST_GCD_NOEXCEPT(T) inline void constexpr_swap(T& a, T& b) BOOST_GCD_NOEXCEPT(T)
{ {