diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2018-01-02 17:17:01 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2018-01-02 17:17:01 +0000 |
| commit | 40a01d5314ffc3c5f4c379cd69015f962dde5f72 (patch) | |
| tree | 33725944bdc9f3baa95beb2ee8612d1a6c1dbaf5 /libcxx/include/variant | |
| parent | 2640a0a5e576ed0474cebc6efd89fe65e1ebbd38 (diff) | |
| download | bcm5719-llvm-40a01d5314ffc3c5f4c379cd69015f962dde5f72.tar.gz bcm5719-llvm-40a01d5314ffc3c5f4c379cd69015f962dde5f72.zip | |
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).
llvm-svn: 321658
Diffstat (limited to 'libcxx/include/variant')
| -rw-r--r-- | libcxx/include/variant | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libcxx/include/variant b/libcxx/include/variant index 8a66add865a..987b8a7982d 100644 --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -76,7 +76,7 @@ namespace std { template <class T> struct variant_size; // undefined template <class T> - constexpr size_t variant_size_v = variant_size<T>::value; + inline constexpr size_t variant_size_v = variant_size<T>::value; template <class T> struct variant_size<const T>; template <class T> struct variant_size<volatile T>; @@ -97,7 +97,7 @@ namespace std { template <size_t I, class... Types> struct variant_alternative<I, variant<Types...>>; - constexpr size_t variant_npos = -1; + inline constexpr size_t variant_npos = -1; // 20.7.4, value access template <class T, class... Types> @@ -246,7 +246,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS variant_size; template <class _Tp> -constexpr size_t variant_size_v = variant_size<_Tp>::value; +_LIBCPP_INLINE_VAR constexpr size_t variant_size_v = variant_size<_Tp>::value; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS variant_size<const _Tp> : variant_size<_Tp> {}; @@ -286,7 +286,7 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> { using type = __type_pack_element<_Ip, _Types...>; }; -constexpr size_t variant_npos = static_cast<size_t>(-1); +_LIBCPP_INLINE_VAR constexpr size_t variant_npos = static_cast<size_t>(-1); constexpr int __choose_index_type(unsigned int __num_elem) { if (__num_elem < std::numeric_limits<unsigned char>::max()) |

