summaryrefslogtreecommitdiffstats
path: root/libcxx/include/iterator
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2017-11-15 20:02:27 +0000
committerMarshall Clow <mclow.lists@gmail.com>2017-11-15 20:02:27 +0000
commit25a7ba4524219e7eeb1254db0d406448f3703d3a (patch)
tree7dcad66bfed31f43ebef9bd15e925e95acfa7a58 /libcxx/include/iterator
parent118a7a99860b5079509a9452b9052053a295f5d7 (diff)
downloadbcm5719-llvm-25a7ba4524219e7eeb1254db0d406448f3703d3a.tar.gz
bcm5719-llvm-25a7ba4524219e7eeb1254db0d406448f3703d3a.zip
More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in string, string_view, and the free function std::empty(). Removed tabs from <string_view>, which is why the diff is so big.
llvm-svn: 318328
Diffstat (limited to 'libcxx/include/iterator')
-rw-r--r--libcxx/include/iterator9
1 files changed, 9 insertions, 0 deletions
diff --git a/libcxx/include/iterator b/libcxx/include/iterator
index 78cab25e535..c7be77bc1de 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -1791,30 +1791,39 @@ end(const _Cp& __c)
#if _LIBCPP_STD_VER > 14
template <class _Cont>
+inline _LIBCPP_INLINE_VISIBILITY
constexpr auto size(const _Cont& __c) -> decltype(__c.size()) { return __c.size(); }
template <class _Tp, size_t _Sz>
+inline _LIBCPP_INLINE_VISIBILITY
constexpr size_t size(const _Tp (&)[_Sz]) noexcept { return _Sz; }
template <class _Cont>
+_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY
constexpr auto empty(const _Cont& __c) -> decltype(__c.empty()) { return __c.empty(); }
template <class _Tp, size_t _Sz>
+_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY
constexpr bool empty(const _Tp (&)[_Sz]) noexcept { return false; }
template <class _Ep>
+_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY
constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; }
template <class _Cont> constexpr
+inline _LIBCPP_INLINE_VISIBILITY
auto data(_Cont& __c) -> decltype(__c.data()) { return __c.data(); }
template <class _Cont> constexpr
+inline _LIBCPP_INLINE_VISIBILITY
auto data(const _Cont& __c) -> decltype(__c.data()) { return __c.data(); }
template <class _Tp, size_t _Sz>
+inline _LIBCPP_INLINE_VISIBILITY
constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; }
template <class _Ep>
+inline _LIBCPP_INLINE_VISIBILITY
constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }
#endif
OpenPOWER on IntegriCloud