Implement most of P0607: Inline Variables for the Standard Library. This involved marking a lot of variables as inline (but only for C++17 and later).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2018-01-02 17:17:01 +00:00
parent 05e705f9ec
commit c58e4723e7
15 changed files with 295 additions and 217 deletions

View File

@@ -63,17 +63,17 @@ typedef ratio< 1000000000000000000000, 1> zetta; // not supported
typedef ratio<1000000000000000000000000, 1> yotta; // not supported
// 20.11.5, ratio comparison
template <class R1, class R2> constexpr bool ratio_equal_v
template <class R1, class R2> inline constexpr bool ratio_equal_v
= ratio_equal<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_not_equal_v
template <class R1, class R2> inline constexpr bool ratio_not_equal_v
= ratio_not_equal<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_less_v
template <class R1, class R2> inline constexpr bool ratio_less_v
= ratio_less<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_less_equal_v
template <class R1, class R2> inline constexpr bool ratio_less_equal_v
= ratio_less_equal<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_greater_v
template <class R1, class R2> inline constexpr bool ratio_greater_v
= ratio_greater<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_greater_equal_v
template <class R1, class R2> inline constexpr bool ratio_greater_equal_v
= ratio_greater_equal<R1, R2>::value; // C++17
}
*/
@@ -501,22 +501,28 @@ struct __ratio_gcd
};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_equal_v
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_equal_v
= ratio_equal<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_not_equal_v
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_not_equal_v
= ratio_not_equal<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_v
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_less_v
= ratio_less<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_equal_v
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_less_equal_v
= ratio_less_equal<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_v
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_greater_v
= ratio_greater<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
= ratio_greater_equal<_R1, _R2>::value;
#endif