diff options
Diffstat (limited to 'contrib/libc++/include/experimental')
-rw-r--r-- | contrib/libc++/include/experimental/__config | 24 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/dynarray | 30 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/optional | 447 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/string_view | 815 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/type_traits | 423 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/utility | 44 |
6 files changed, 1642 insertions, 141 deletions
diff --git a/contrib/libc++/include/experimental/__config b/contrib/libc++/include/experimental/__config new file mode 100644 index 0000000..684a3b4 --- /dev/null +++ b/contrib/libc++/include/experimental/__config @@ -0,0 +1,24 @@ +// -*- C++ -*- +//===--------------------------- __config ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_EXPERIMENTAL_CONFIG +#define _LIBCPP_EXPERIMENTAL_CONFIG + +#include <__config> + +#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace std { namespace experimental { +#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } } +#define _VSTD_EXPERIMENTAL std::experimental + +#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 { +#define _LIBCPP_END_NAMESPACE_LFTS } } } +#define _VSTD_LFTS _VSTD_EXPERIMENTAL::fundamentals_v1 + +#endif diff --git a/contrib/libc++/include/experimental/dynarray b/contrib/libc++/include/experimental/dynarray index 7c5c9b3..0bc8dfe 100644 --- a/contrib/libc++/include/experimental/dynarray +++ b/contrib/libc++/include/experimental/dynarray @@ -38,18 +38,18 @@ class dynarray public: // construct/copy/destroy: explicit dynarray(size_type c); - template <typename Alloc> - dynarray(size_type c, const Alloc& alloc); dynarray(size_type c, const T& v); - template <typename Alloc> - dynarray(size_type c, const T& v, const Alloc& alloc); dynarray(const dynarray& d); - template <typename Alloc> - dynarray(const dynarray& d, const Alloc& alloc); dynarray(initializer_list<T>); - template <typename Alloc> - dynarray(initializer_list<T>, const Alloc& alloc); + template <class Alloc> + dynarray(allocator_arg_t, const Alloc& a, size_type c, const Alloc& alloc); + template <class Alloc> + dynarray(allocator_arg_t, const Alloc& a, size_type c, const T& v, const Alloc& alloc); + template <class Alloc> + dynarray(allocator_arg_t, const Alloc& a, const dynarray& d, const Alloc& alloc); + template <class Alloc> + dynarray(allocator_arg_t, const Alloc& a, initializer_list<T>, const Alloc& alloc); dynarray& operator=(const dynarray&) = delete; ~dynarray(); @@ -147,12 +147,12 @@ private: assert(!"dynarray::allocation"); #endif } - return static_cast<value_type *> (::operator new (sizeof(value_type) * count)); + return static_cast<value_type *> (_VSTD::__allocate (sizeof(value_type) * count)); } static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept { - ::operator delete (static_cast<void *> (__ptr)); + _VSTD::__deallocate (static_cast<void *> (__ptr)); } public: @@ -163,15 +163,15 @@ public: dynarray(initializer_list<value_type>); // We're not implementing these right now. -// Waiting for the resolution of LWG issue #2235 +// Updated with the resolution of LWG issue #2255 // template <typename _Alloc> -// dynarray(size_type __c, const _Alloc& __alloc); +// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c); // template <typename _Alloc> -// dynarray(size_type __c, const value_type& __v, const _Alloc& __alloc); +// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c, const value_type& __v); // template <typename _Alloc> -// dynarray(const dynarray& __d, const _Alloc& __alloc); +// dynarray(allocator_arg_t, const _Alloc& __alloc, const dynarray& __d); // template <typename _Alloc> -// dynarray(initializer_list<value_type>, const _Alloc& __alloc); +// dynarray(allocator_arg_t, const _Alloc& __alloc, initializer_list<value_type>); dynarray& operator=(const dynarray&) = delete; ~dynarray(); diff --git a/contrib/libc++/include/experimental/optional b/contrib/libc++/include/experimental/optional index 3848da8..a384882 100644 --- a/contrib/libc++/include/experimental/optional +++ b/contrib/libc++/include/experimental/optional @@ -16,131 +16,147 @@ // C++1y -#include <initializer_list> - -namespace std { namespace experimental { - -// optional for object types -template <class T> -class optional -{ -public: - typedef T value_type; - - // constructors - constexpr optional() noexcept; - constexpr optional(nullopt_t) noexcept; - optional(const optional&); - optional(optional&&) noexcept(is_nothrow_move_constructible<T>::value); - constexpr optional(const T&); - constexpr optional(T&&); - template <class... Args> constexpr explicit optional(in_place_t, Args&&...); - template <class U, class... Args> - constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...); - - // destructor - ~optional(); - - // assignment - optional& operator=(nullopt_t) noexcept; - optional& operator=(const optional&); - optional& operator=(optional&&) - noexcept(is_nothrow_move_assignable<T>::value && - is_nothrow_move_constructible<T>::value); - template <class U> optional& operator=(U&&); - template <class... Args> void emplace(Args&&...); - template <class U, class... Args> void emplace(initializer_list<U>, Args&&...); - - // swap - void swap(optional&) - noexcept(is_nothrow_move_constructible<T>::value && - noexcept(swap(declval<T&>(), declval<T&>()))); - - // observers - constexpr T const* operator->() const; - T* operator->(); - constexpr T const& operator*() const; - T& operator*(); - constexpr explicit operator bool() const noexcept; - constexpr T const& value() const; - T& value(); - template <class U> constexpr T value_or(U&&) const&; - template <class U> T value_or(U&&) &&; -}; - -// In-place construction -struct in_place_t{}; -constexpr in_place_t in_place{}; - -// Disengaged state indicator -struct nullopt_t{see below}; -constexpr nullopt_t nullopt(unspecified); - -// class bad_optional_access -class bad_optional_access - : public logic_error -{ -public: - explicit bad_optional_access(const string& what_arg); - explicit bad_optional_access(const char* what_arg); -}; - -// Relational operators -template <class T> constexpr bool operator==(const optional<T>&, const optional<T>&); -template <class T> constexpr bool operator< (const optional<T>&, const optional<T>&); - -// Comparison with nullopt -template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept; -template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept; -template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept; -template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept; - -// Comparison with T -template <class T> constexpr bool operator==(const optional<T>&, const T&); -template <class T> constexpr bool operator==(const T&, const optional<T>&); -template <class T> constexpr bool operator<(const optional<T>&, const T&); -template <class T> constexpr bool operator<(const T&, const optional<T>&); - -// Specialized algorithms -template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below); -template <class T> constexpr optional<typename decay<T>::type> make_optional(T&&); - -// hash support -template <class T> struct hash; -template <class T> struct hash<optional<T>>; - -}} // std::experimental +namespace std { namespace experimental { inline namespace fundamentals_v1 { + + // 5.3, optional for object types + template <class T> class optional; + + // 5.4, In-place construction + struct in_place_t{}; + constexpr in_place_t in_place{}; + + // 5.5, No-value state indicator + struct nullopt_t{see below}; + constexpr nullopt_t nullopt(unspecified); + + // 5.6, Class bad_optional_access + class bad_optional_access; + + // 5.7, Relational operators + template <class T> + constexpr bool operator==(const optional<T>&, const optional<T>&); + template <class T> + constexpr bool operator!=(const optional<T>&, const optional<T>&); + template <class T> + constexpr bool operator<(const optional<T>&, const optional<T>&); + template <class T> + constexpr bool operator>(const optional<T>&, const optional<T>&); + template <class T> + constexpr bool operator<=(const optional<T>&, const optional<T>&); + template <class T> + constexpr bool operator>=(const optional<T>&, const optional<T>&); + + // 5.8, Comparison with nullopt + template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept; + template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept; + template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept; + template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept; + template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept; + template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept; + template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept; + template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept; + template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept; + template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept; + template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept; + template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept; + + // 5.9, Comparison with T + template <class T> constexpr bool operator==(const optional<T>&, const T&); + template <class T> constexpr bool operator==(const T&, const optional<T>&); + template <class T> constexpr bool operator!=(const optional<T>&, const T&); + template <class T> constexpr bool operator!=(const T&, const optional<T>&); + template <class T> constexpr bool operator<(const optional<T>&, const T&); + template <class T> constexpr bool operator<(const T&, const optional<T>&); + template <class T> constexpr bool operator<=(const optional<T>&, const T&); + template <class T> constexpr bool operator<=(const T&, const optional<T>&); + template <class T> constexpr bool operator>(const optional<T>&, const T&); + template <class T> constexpr bool operator>(const T&, const optional<T>&); + template <class T> constexpr bool operator>=(const optional<T>&, const T&); + template <class T> constexpr bool operator>=(const T&, const optional<T>&); + + // 5.10, Specialized algorithms + template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below); + template <class T> constexpr optional<see below> make_optional(T&&); + + template <class T> + class optional + { + public: + typedef T value_type; + + // 5.3.1, Constructors + constexpr optional() noexcept; + constexpr optional(nullopt_t) noexcept; + optional(const optional&); + optional(optional&&) noexcept(see below); + constexpr optional(const T&); + constexpr optional(T&&); + template <class... Args> constexpr explicit optional(in_place_t, Args&&...); + template <class U, class... Args> + constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...); + + // 5.3.2, Destructor + ~optional(); + + // 5.3.3, Assignment + optional& operator=(nullopt_t) noexcept; + optional& operator=(const optional&); + optional& operator=(optional&&) noexcept(see below); + template <class U> optional& operator=(U&&); + template <class... Args> void emplace(Args&&...); + template <class U, class... Args> + void emplace(initializer_list<U>, Args&&...); + + // 5.3.4, Swap + void swap(optional&) noexcept(see below); + + // 5.3.5, Observers + constexpr T const* operator ->() const; + constexpr T* operator ->(); + constexpr T const& operator *() const &; + constexpr T& operator *() &; + constexpr T&& operator *() &&; + constexpr const T&& operator *() const &&; + constexpr explicit operator bool() const noexcept; + constexpr T const& value() const &; + constexpr T& value() &; + constexpr T&& value() &&; + constexpr const T&& value() const &&; + template <class U> constexpr T value_or(U&&) const &; + template <class U> constexpr T value_or(U&&) &&; + + private: + T* val; // exposition only + }; + + } // namespace fundamentals_v1 + } // namespace experimental + + // 5.11, Hash support + template <class T> struct hash; + template <class T> struct hash<experimental::optional<T>>; + +} // namespace std */ -#include <__config> +#include <experimental/__config> #include <functional> #include <stdexcept> -namespace std { namespace experimental { - +_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL class _LIBCPP_EXCEPTION_ABI bad_optional_access - : public logic_error + : public std::logic_error { public: -#if _LIBCPP_STD_VER > 11 - _LIBCPP_INLINE_VISIBILITY explicit bad_optional_access(const string& __arg) - : logic_error(__arg) {} - _LIBCPP_INLINE_VISIBILITY explicit bad_optional_access(const char* __arg) - : logic_error(__arg) {} - _LIBCPP_INLINE_VISIBILITY bad_optional_access(const bad_optional_access&) noexcept = default; - _LIBCPP_INLINE_VISIBILITY bad_optional_access& operator=(const bad_optional_access&) noexcept = default; -#else -private: - bad_optional_access(const bad_optional_access&); - bad_optional_access& operator=(const bad_optional_access&); -public: -#endif // _LIBCPP_STD_VER > 11 - // Get the key function ~bad_optional_access() into the dylib even if not compiling for C++1y + bad_optional_access() : std::logic_error("Bad optional Access") {} + +// Get the key function ~bad_optional_access() into the dylib virtual ~bad_optional_access() _NOEXCEPT; }; -}} // std::experimental +_LIBCPP_END_NAMESPACE_EXPERIMENTAL + #if _LIBCPP_STD_VER > 11 @@ -148,20 +164,14 @@ public: #include <type_traits> #include <new> #include <__functional_base> - #include <__undef_min_max> - -#ifdef _LIBCPP_DEBUG -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -namespace std { namespace experimental { inline namespace __library_fundamentals_v1 { +_LIBCPP_BEGIN_NAMESPACE_LFTS struct in_place_t {}; constexpr in_place_t in_place{}; @@ -507,7 +517,7 @@ public: constexpr value_type const& value() const { if (!this->__engaged_) - throw bad_optional_access("optional<T>::value: not engaged"); + throw bad_optional_access(); return this->__val_; } @@ -515,7 +525,7 @@ public: value_type& value() { if (!this->__engaged_) - throw bad_optional_access("optional<T>::value: not engaged"); + throw bad_optional_access(); return this->__val_; } @@ -560,6 +570,7 @@ private: } }; +// Comparisons between optionals template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY constexpr @@ -577,19 +588,57 @@ template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY constexpr bool +operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y) +{ + return !(__x == __y); +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool operator<(const optional<_Tp>& __x, const optional<_Tp>& __y) { if (!static_cast<bool>(__y)) return false; if (!static_cast<bool>(__x)) return true; - return less<_Tp>{}(*__x, *__y); + return *__x < *__y; } template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY constexpr bool +operator>(const optional<_Tp>& __x, const optional<_Tp>& __y) +{ + return __y < __x; +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y) +{ + return !(__y < __x); +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y) +{ + return !(__x < __y); +} + + +// Comparisons with nullopt +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool operator==(const optional<_Tp>& __x, nullopt_t) noexcept { return !static_cast<bool>(__x); @@ -608,6 +657,24 @@ template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY constexpr bool +operator!=(const optional<_Tp>& __x, nullopt_t) noexcept +{ + return static_cast<bool>(__x); +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator!=(nullopt_t, const optional<_Tp>& __x) noexcept +{ + return static_cast<bool>(__x); +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool operator<(const optional<_Tp>&, nullopt_t) noexcept { return false; @@ -626,6 +693,61 @@ template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY constexpr bool +operator<=(const optional<_Tp>& __x, nullopt_t) noexcept +{ + return !static_cast<bool>(__x); +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator<=(nullopt_t, const optional<_Tp>& __x) noexcept +{ + return true; +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator>(const optional<_Tp>& __x, nullopt_t) noexcept +{ + return static_cast<bool>(__x); +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator>(nullopt_t, const optional<_Tp>& __x) noexcept +{ + return false; +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator>=(const optional<_Tp>&, nullopt_t) noexcept +{ + return true; +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator>=(nullopt_t, const optional<_Tp>& __x) noexcept +{ + return !static_cast<bool>(__x); +} + +// Comparisons with T +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool operator==(const optional<_Tp>& __x, const _Tp& __v) { return static_cast<bool>(__x) ? *__x == __v : false; @@ -644,6 +766,24 @@ template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY constexpr bool +operator!=(const optional<_Tp>& __x, const _Tp& __v) +{ + return static_cast<bool>(__x) ? !(*__x == __v) : true; +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator!=(const _Tp& __v, const optional<_Tp>& __x) +{ + return static_cast<bool>(__x) ? !(*__x == __v) : true; +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool operator<(const optional<_Tp>& __x, const _Tp& __v) { return static_cast<bool>(__x) ? less<_Tp>{}(*__x, __v) : true; @@ -660,6 +800,61 @@ operator<(const _Tp& __v, const optional<_Tp>& __x) template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator<=(const optional<_Tp>& __x, const _Tp& __v) +{ + return !(__x > __v); +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator<=(const _Tp& __v, const optional<_Tp>& __x) +{ + return !(__v > __x); +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator>(const optional<_Tp>& __x, const _Tp& __v) +{ + return static_cast<bool>(__x) ? __v < __x : false; +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator>(const _Tp& __v, const optional<_Tp>& __x) +{ + return static_cast<bool>(__x) ? __x < __v : true; +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator>=(const optional<_Tp>& __x, const _Tp& __v) +{ + return !(__x < __v); +} + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +constexpr +bool +operator>=(const _Tp& __v, const optional<_Tp>& __x) +{ + return !(__v < __x); +} + + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY void swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) { @@ -675,7 +870,7 @@ make_optional(_Tp&& __v) return optional<typename decay<_Tp>::type>(_VSTD::forward<_Tp>(__v)); } -}}} // namespace std::experimental::__library_fundamentals_v1 +_LIBCPP_END_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_STD @@ -696,4 +891,4 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER > 11 -#endif // _LIBCPP_ARRAY +#endif // _LIBCPP_OPTIONAL diff --git a/contrib/libc++/include/experimental/string_view b/contrib/libc++/include/experimental/string_view new file mode 100644 index 0000000..d423f39 --- /dev/null +++ b/contrib/libc++/include/experimental/string_view @@ -0,0 +1,815 @@ +// -*- C++ -*- +//===------------------------ string_view ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_LFTS_STRING_VIEW +#define _LIBCPP_LFTS_STRING_VIEW + +/* +string_view synopsis + +namespace std { + namespace experimental { + inline namespace library_fundamentals_v1 { + + // 7.2, Class template basic_string_view + template<class charT, class traits = char_traits<charT>> + class basic_string_view; + + // 7.9, basic_string_view non-member comparison functions + template<class charT, class traits> + constexpr bool operator==(basic_string_view<charT, traits> x, + basic_string_view<charT, traits> y) noexcept; + template<class charT, class traits> + constexpr bool operator!=(basic_string_view<charT, traits> x, + basic_string_view<charT, traits> y) noexcept; + template<class charT, class traits> + constexpr bool operator< (basic_string_view<charT, traits> x, + basic_string_view<charT, traits> y) noexcept; + template<class charT, class traits> + constexpr bool operator> (basic_string_view<charT, traits> x, + basic_string_view<charT, traits> y) noexcept; + template<class charT, class traits> + constexpr bool operator<=(basic_string_view<charT, traits> x, + basic_string_view<charT, traits> y) noexcept; + template<class charT, class traits> + constexpr bool operator>=(basic_string_view<charT, traits> x, + basic_string_view<charT, traits> y) noexcept; + // see below, sufficient additional overloads of comparison functions + + // 7.10, Inserters and extractors + template<class charT, class traits> + basic_ostream<charT, traits>& + operator<<(basic_ostream<charT, traits>& os, + basic_string_view<charT, traits> str); + + // basic_string_view typedef names + typedef basic_string_view<char> string_view; + typedef basic_string_view<char16_t> u16string_view; + typedef basic_string_view<char32_t> u32string_view; + typedef basic_string_view<wchar_t> wstring_view; + + template<class charT, class traits = char_traits<charT>> + class basic_string_view { + public: + // types + typedef traits traits_type; + typedef charT value_type; + typedef charT* pointer; + typedef const charT* const_pointer; + typedef charT& reference; + typedef const charT& const_reference; + typedef implementation-defined const_iterator; + typedef const_iterator iterator; + typedef reverse_iterator<const_iterator> const_reverse_iterator; + typedef const_reverse_iterator reverse_iterator; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + static constexpr size_type npos = size_type(-1); + + // 7.3, basic_string_view constructors and assignment operators + constexpr basic_string_view() noexcept; + constexpr basic_string_view(const basic_string_view&) noexcept = default; + basic_string_view& operator=(const basic_string_view&) noexcept = default; + template<class Allocator> + basic_string_view(const basic_string<charT, traits, Allocator>& str) noexcept; + constexpr basic_string_view(const charT* str); + constexpr basic_string_view(const charT* str, size_type len); + + // 7.4, basic_string_view iterator support + constexpr const_iterator begin() const noexcept; + constexpr const_iterator end() const noexcept; + constexpr const_iterator cbegin() const noexcept; + constexpr const_iterator cend() const noexcept; + const_reverse_iterator rbegin() const noexcept; + const_reverse_iterator rend() const noexcept; + const_reverse_iterator crbegin() const noexcept; + const_reverse_iterator crend() const noexcept; + + // 7.5, basic_string_view capacity + constexpr size_type size() const noexcept; + constexpr size_type length() const noexcept; + constexpr size_type max_size() const noexcept; + constexpr bool empty() const noexcept; + + // 7.6, basic_string_view element access + constexpr const_reference operator[](size_type pos) const; + constexpr const_reference at(size_type pos) const; + constexpr const_reference front() const; + constexpr const_reference back() const; + constexpr const_pointer data() const noexcept; + + // 7.7, basic_string_view modifiers + constexpr void clear() noexcept; + constexpr void remove_prefix(size_type n); + constexpr void remove_suffix(size_type n); + constexpr void swap(basic_string_view& s) noexcept; + + // 7.8, basic_string_view string operations + template<class Allocator> + explicit operator basic_string<charT, traits, Allocator>() const; + template<class Allocator = allocator<charT>> + basic_string<charT, traits, Allocator> to_string( + const Allocator& a = Allocator()) const; + + size_type copy(charT* s, size_type n, size_type pos = 0) const; + + constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const; + constexpr int compare(basic_string_view s) const noexcept; + constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const; + constexpr int compare(size_type pos1, size_type n1, + basic_string_view s, size_type pos2, size_type n2) const; + constexpr int compare(const charT* s) const; + constexpr int compare(size_type pos1, size_type n1, const charT* s) const; + constexpr int compare(size_type pos1, size_type n1, + const charT* s, size_type n2) const; + constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept; + constexpr size_type find(charT c, size_type pos = 0) const noexcept; + constexpr size_type find(const charT* s, size_type pos, size_type n) const; + constexpr size_type find(const charT* s, size_type pos = 0) const; + constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept; + constexpr size_type rfind(charT c, size_type pos = npos) const noexcept; + constexpr size_type rfind(const charT* s, size_type pos, size_type n) const; + constexpr size_type rfind(const charT* s, size_type pos = npos) const; + constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept; + constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept; + constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const; + constexpr size_type find_first_of(const charT* s, size_type pos = 0) const; + constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept; + constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept; + constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const; + constexpr size_type find_last_of(const charT* s, size_type pos = npos) const; + constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept; + constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept; + constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const; + constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const; + constexpr size_type find_last_not_of(basic_string_view s, size_type pos = npos) const noexcept; + constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept; + constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const; + constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const; + + private: + const_pointer data_; // exposition only + size_type size_; // exposition only + }; + + } // namespace fundamentals_v1 + } // namespace experimental + + // 7.11, Hash support + template <class T> struct hash; + template <> struct hash<experimental::string_view>; + template <> struct hash<experimental::u16string_view>; + template <> struct hash<experimental::u32string_view>; + template <> struct hash<experimental::wstring_view>; + +} // namespace std + + +*/ + +#include <experimental/__config> + +#include <string> +#include <algorithm> +#include <iterator> +#include <ostream> +#include <iomanip> + +#include <__debug> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS + + template<class _CharT, class _Traits = _VSTD::char_traits<_CharT> > + class _LIBCPP_TYPE_VIS_ONLY basic_string_view { + public: + // types + typedef _Traits traits_type; + typedef _CharT value_type; + typedef const _CharT* pointer; + typedef const _CharT* const_pointer; + typedef const _CharT& reference; + typedef const _CharT& const_reference; + typedef const_pointer const_iterator; // See [string.view.iterators] + typedef const_iterator iterator; + typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; + typedef const_reverse_iterator reverse_iterator; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1); + + // [string.view.cons], construct/copy + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {} + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + basic_string_view(const basic_string_view&) _NOEXCEPT = default; + + _LIBCPP_INLINE_VISIBILITY + basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default; + + template<class _Allocator> + _LIBCPP_INLINE_VISIBILITY + basic_string_view(const basic_string<_CharT, _Traits, _Allocator>& __str) _NOEXCEPT + : __data (__str.data()), __size(__str.size()) {} + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + basic_string_view(const _CharT* __s, size_type __len) + : __data(__s), __size(__len) + { +// _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): recieved nullptr"); + } + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + basic_string_view(const _CharT* __s) + : __data(__s), __size(_Traits::length(__s)) {} + + // [string.view.iterators], iterators + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + const_iterator begin() const _NOEXCEPT { return cbegin(); } + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + const_iterator end() const _NOEXCEPT { return cend(); } + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + const_iterator cbegin() const _NOEXCEPT { return __data; } + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + const_iterator cend() const _NOEXCEPT { return __data + __size; } + + _LIBCPP_INLINE_VISIBILITY + const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); } + + _LIBCPP_INLINE_VISIBILITY + const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); } + + _LIBCPP_INLINE_VISIBILITY + const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); } + + _LIBCPP_INLINE_VISIBILITY + const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); } + + // [string.view.capacity], capacity + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + size_type size() const _NOEXCEPT { return __size; } + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + size_type length() const _NOEXCEPT { return __size; } + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + size_type max_size() const _NOEXCEPT { return _VSTD::numeric_limits<size_type>::max(); } + + _LIBCPP_CONSTEXPR bool _LIBCPP_INLINE_VISIBILITY + empty() const _NOEXCEPT { return __size == 0; } + + // [string.view.access], element access + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + const_reference operator[](size_type __pos) const { return __data[__pos]; } + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + const_reference at(size_type __pos) const + { + return __pos >= size() + ? throw out_of_range("string_view::at") + : __data[__pos]; +// if (__pos >= size()) +// throw out_of_range("string_view::at"); +// return __data[__pos]; + } + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + const_reference front() const + { + return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0]; + } + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + const_reference back() const + { + return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1]; + } + + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + const_pointer data() const _NOEXCEPT { return __data; } + + // [string.view.modifiers], modifiers: + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + void clear() _NOEXCEPT + { + __data = nullptr; + __size = 0; + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + void remove_prefix(size_type __n) _NOEXCEPT + { + _LIBCPP_ASSERT(n <= size(), "remove_prefix() can't remove more than size()"); + __data += __n; + __size -= __n; + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + void remove_suffix(size_type __n) _NOEXCEPT + { + _LIBCPP_ASSERT(n <= size(), "remove_suffix() can't remove more than size()"); + __size -= __n; + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + void swap(basic_string_view& __other) _NOEXCEPT + { + const value_type *__p = __data; + __data = __other.__data; + __other.__data = __p; + + size_type __sz = __size; + __size = __other.__size; + __other.__size = __sz; +// _VSTD::swap( __data, __other.__data ); +// _VSTD::swap( __size, __other.__size ); + } + + // [string.view.ops], string operations: + template<class _Allocator> + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_EXPLICIT operator basic_string<_CharT, _Traits, _Allocator>() const + { return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); } + + template<class _Allocator = allocator<_CharT> > + _LIBCPP_INLINE_VISIBILITY + basic_string<_CharT, _Traits, _Allocator> + to_string( const _Allocator& __a = _Allocator()) const + { return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); } + + size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const + { + if ( __pos > size()) + throw out_of_range("string_view::copy"); + size_type __rlen = _VSTD::min( __n, size() - __pos ); + _VSTD::copy_n(begin() + __pos, __rlen, __s ); + return __rlen; + } + + _LIBCPP_CONSTEXPR + basic_string_view substr(size_type __pos = 0, size_type __n = npos) const + { +// if (__pos > size()) +// throw out_of_range("string_view::substr"); +// size_type __rlen = _VSTD::min( __n, size() - __pos ); +// return basic_string_view(data() + __pos, __rlen); + return __pos > size() + ? throw out_of_range("string_view::substr") + : basic_string_view(data() + __pos, _VSTD::min(__n, size() - __pos)); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT + { + size_type __rlen = _VSTD::min( size(), __sv.size()); + int __retval = _Traits::compare(data(), __sv.data(), __rlen); + if ( __retval == 0 ) // first __rlen chars matched + __retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 ); + return __retval; + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const + { + return substr(__pos1, __n1).compare(__sv); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + int compare( size_type __pos1, size_type __n1, + basic_string_view _sv, size_type __pos2, size_type __n2) const + { + return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2)); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + int compare(const _CharT* __s) const + { + return compare(basic_string_view(__s)); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + int compare(size_type __pos1, size_type __n1, const _CharT* __s) const + { + return substr(__pos1, __n1).compare(basic_string_view(__s)); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const + { + return substr(__pos1, __n1).compare(basic_string_view(__s, __n2)); + } + + // find + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT + { + _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr"); + return _VSTD::__str_find<value_type, size_type, traits_type, npos> + (data(), size(), __s.data(), __pos, __s.size()); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT + { + return _VSTD::__str_find<value_type, size_type, traits_type, npos> + (data(), size(), __c, __pos); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find(const _CharT* __s, size_type __pos, size_type __n) const + { + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): recieved nullptr"); + return _VSTD::__str_find<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, __n); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find(const _CharT* __s, size_type __pos = 0) const + { + _LIBCPP_ASSERT(__s != nullptr, "string_view::find(): recieved nullptr"); + return _VSTD::__str_find<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, traits_type::length(__s)); + } + + // rfind + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT + { + _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr"); + return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> + (data(), size(), __s.data(), __pos, __s.size()); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT + { + return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> + (data(), size(), __c, __pos); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const + { + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): recieved nullptr"); + return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, __n); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type rfind(const _CharT* __s, size_type __pos=npos) const + { + _LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): recieved nullptr"); + return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, traits_type::length(__s)); + } + + // find_first_of + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT + { + _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): recieved nullptr"); + return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos> + (data(), size(), __s.data(), __pos, __s.size()); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT + { return find(__c, __pos); } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const + { + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): recieved nullptr"); + return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, __n); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_first_of(const _CharT* __s, size_type __pos=0) const + { + _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): recieved nullptr"); + return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, traits_type::length(__s)); + } + + // find_last_of + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT + { + _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): recieved nullptr"); + return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos> + (data(), size(), __s.data(), __pos, __s.size()); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT + { return rfind(__c, __pos); } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const + { + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): recieved nullptr"); + return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, __n); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_last_of(const _CharT* __s, size_type __pos=npos) const + { + _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): recieved nullptr"); + return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, traits_type::length(__s)); + } + + // find_first_not_of + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT + { + _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): recieved nullptr"); + return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> + (data(), size(), __s.data(), __pos, __s.size()); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT + { + return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> + (data(), size(), __c, __pos); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const + { + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): recieved nullptr"); + return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, __n); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const + { + _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): recieved nullptr"); + return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, traits_type::length(__s)); + } + + // find_last_not_of + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT + { + _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): recieved nullptr"); + return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> + (data(), size(), __s.data(), __pos, __s.size()); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT + { + return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> + (data(), size(), __c, __pos); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const + { + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): recieved nullptr"); + return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, __n); + } + + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const + { + _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): recieved nullptr"); + return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, traits_type::length(__s)); + } + + private: + const value_type* __data; + size_type __size; + }; + + + // [string.view.comparison] + // operator == + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator==(basic_string_view<_CharT, _Traits> __lhs, + basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + if ( __lhs.size() != __rhs.size()) return false; + return __lhs.compare(__rhs) == 0; + } + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator==(basic_string_view<_CharT, _Traits> __lhs, + typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT + { + if ( __lhs.size() != __rhs.size()) return false; + return __lhs.compare(__rhs) == 0; + } + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator==(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, + basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + if ( __lhs.size() != __rhs.size()) return false; + return __lhs.compare(__rhs) == 0; + } + + + // operator != + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + if ( __lhs.size() != __rhs.size()) + return true; + return __lhs.compare(__rhs) != 0; + } + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator!=(basic_string_view<_CharT, _Traits> __lhs, + typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT + { + if ( __lhs.size() != __rhs.size()) + return true; + return __lhs.compare(__rhs) != 0; + } + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator!=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, + basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + if ( __lhs.size() != __rhs.size()) + return true; + return __lhs.compare(__rhs) != 0; + } + + + // operator < + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) < 0; + } + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator<(basic_string_view<_CharT, _Traits> __lhs, + typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) < 0; + } + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator<(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, + basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) < 0; + } + + + // operator > + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) > 0; + } + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator>(basic_string_view<_CharT, _Traits> __lhs, + typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) > 0; + } + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator>(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, + basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) > 0; + } + + + // operator <= + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) <= 0; + } + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator<=(basic_string_view<_CharT, _Traits> __lhs, + typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) <= 0; + } + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator<=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, + basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) <= 0; + } + + + // operator >= + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) >= 0; + } + + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator>=(basic_string_view<_CharT, _Traits> __lhs, + typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) >= 0; + } + + template<class _CharT, class _Traits> + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + bool operator>=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, + basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT + { + return __lhs.compare(__rhs) >= 0; + } + + + // [string.view.io] + template<class _CharT, class _Traits> + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv) + { + return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size()); + } + + typedef basic_string_view<char> string_view; + typedef basic_string_view<char16_t> u16string_view; + typedef basic_string_view<char32_t> u32string_view; + typedef basic_string_view<wchar_t> wstring_view; + +_LIBCPP_END_NAMESPACE_LFTS +_LIBCPP_BEGIN_NAMESPACE_STD + +// [string.view.hash] +// Shamelessly stolen from <string> +template<class _CharT, class _Traits> +struct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::basic_string_view<_CharT, _Traits> > + : public unary_function<std::experimental::basic_string_view<_CharT, _Traits>, size_t> +{ + size_t operator()(const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT; +}; + +template<class _CharT, class _Traits> +size_t +hash<std::experimental::basic_string_view<_CharT, _Traits> >::operator()( + const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT +{ + return __do_string_hash(__val.data(), __val.data() + __val.size()); +} + +#if _LIBCPP_STD_VER > 11 +template <class _CharT, class _Traits> +__quoted_output_proxy<_CharT, const _CharT *, _Traits> +quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv, + _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) +{ + return __quoted_output_proxy<_CharT, const _CharT *, _Traits> + ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape ); +} +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_LFTS_STRING_VIEW diff --git a/contrib/libc++/include/experimental/type_traits b/contrib/libc++/include/experimental/type_traits new file mode 100644 index 0000000..ab2c8cd --- /dev/null +++ b/contrib/libc++/include/experimental/type_traits @@ -0,0 +1,423 @@ +// -*- C++ -*- +//===-------------------------- type_traits -------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_EXPERIMENTAL_TYPE_TRAITS +#define _LIBCPP_EXPERIMENTAL_TYPE_TRAITS + +/** + experimental/type_traits synopsis + +// C++1y +#include <type_traits> + +namespace std { +namespace experimental { +inline namespace fundamentals_v1 { + + // See C++14 20.10.4.1, primary type categories + template <class T> constexpr bool is_void_v + = is_void<T>::value; + template <class T> constexpr bool is_null_pointer_v + = is_null_pointer<T>::value; + template <class T> constexpr bool is_integral_v + = is_integral<T>::value; + template <class T> constexpr bool is_floating_point_v + = is_floating_point<T>::value; + template <class T> constexpr bool is_array_v + = is_array<T>::value; + template <class T> constexpr bool is_pointer_v + = is_pointer<T>::value; + template <class T> constexpr bool is_lvalue_reference_v + = is_lvalue_reference<T>::value; + template <class T> constexpr bool is_rvalue_reference_v + = is_rvalue_reference<T>::value; + template <class T> constexpr bool is_member_object_pointer_v + = is_member_object_pointer<T>::value; + template <class T> constexpr bool is_member_function_pointer_v + = is_member_function_pointer<T>::value; + template <class T> constexpr bool is_enum_v + = is_enum<T>::value; + template <class T> constexpr bool is_union_v + = is_union<T>::value; + template <class T> constexpr bool is_class_v + = is_class<T>::value; + template <class T> constexpr bool is_function_v + = is_function<T>::value; + + // See C++14 20.10.4.2, composite type categories + template <class T> constexpr bool is_reference_v + = is_reference<T>::value; + template <class T> constexpr bool is_arithmetic_v + = is_arithmetic<T>::value; + template <class T> constexpr bool is_fundamental_v + = is_fundamental<T>::value; + template <class T> constexpr bool is_object_v + = is_object<T>::value; + template <class T> constexpr bool is_scalar_v + = is_scalar<T>::value; + template <class T> constexpr bool is_compound_v + = is_compound<T>::value; + template <class T> constexpr bool is_member_pointer_v + = is_member_pointer<T>::value; + + // See C++14 20.10.4.3, type properties + template <class T> constexpr bool is_const_v + = is_const<T>::value; + template <class T> constexpr bool is_volatile_v + = is_volatile<T>::value; + template <class T> constexpr bool is_trivial_v + = is_trivial<T>::value; + template <class T> constexpr bool is_trivially_copyable_v + = is_trivially_copyable<T>::value; + template <class T> constexpr bool is_standard_layout_v + = is_standard_layout<T>::value; + template <class T> constexpr bool is_pod_v + = is_pod<T>::value; + template <class T> constexpr bool is_literal_type_v + = is_literal_type<T>::value; + template <class T> constexpr bool is_empty_v + = is_empty<T>::value; + template <class T> constexpr bool is_polymorphic_v + = is_polymorphic<T>::value; + template <class T> constexpr bool is_abstract_v + = is_abstract<T>::value; + template <class T> constexpr bool is_final_v + = is_final<T>::value; + template <class T> constexpr bool is_signed_v + = is_signed<T>::value; + template <class T> constexpr bool is_unsigned_v + = is_unsigned<T>::value; + template <class T, class... Args> constexpr bool is_constructible_v + = is_constructible<T, Args...>::value; + template <class T> constexpr bool is_default_constructible_v + = is_default_constructible<T>::value; + template <class T> constexpr bool is_copy_constructible_v + = is_copy_constructible<T>::value; + template <class T> constexpr bool is_move_constructible_v + = is_move_constructible<T>::value; + template <class T, class U> constexpr bool is_assignable_v + = is_assignable<T, U>::value; + template <class T> constexpr bool is_copy_assignable_v + = is_copy_assignable<T>::value; + template <class T> constexpr bool is_move_assignable_v + = is_move_assignable<T>::value; + template <class T> constexpr bool is_destructible_v + = is_destructible<T>::value; + template <class T, class... Args> constexpr bool is_trivially_constructible_v + = is_trivially_constructible<T, Args...>::value; + template <class T> constexpr bool is_trivially_default_constructible_v + = is_trivially_default_constructible<T>::value; + template <class T> constexpr bool is_trivially_copy_constructible_v + = is_trivially_copy_constructible<T>::value; + template <class T> constexpr bool is_trivially_move_constructible_v + = is_trivially_move_constructible<T>::value; + template <class T, class U> constexpr bool is_trivially_assignable_v + = is_trivially_assignable<T, U>::value; + template <class T> constexpr bool is_trivially_copy_assignable_v + = is_trivially_copy_assignable<T>::value; + template <class T> constexpr bool is_trivially_move_assignable_v + = is_trivially_move_assignable<T>::value; + template <class T> constexpr bool is_trivially_destructible_v + = is_trivially_destructible<T>::value; + template <class T, class... Args> constexpr bool is_nothrow_constructible_v + = is_nothrow_constructible<T, Args...>::value; + template <class T> constexpr bool is_nothrow_default_constructible_v + = is_nothrow_default_constructible<T>::value; + template <class T> constexpr bool is_nothrow_copy_constructible_v + = is_nothrow_copy_constructible<T>::value; + template <class T> constexpr bool is_nothrow_move_constructible_v + = is_nothrow_move_constructible<T>::value; + template <class T, class U> constexpr bool is_nothrow_assignable_v + = is_nothrow_assignable<T, U>::value; + template <class T> constexpr bool is_nothrow_copy_assignable_v + = is_nothrow_copy_assignable<T>::value; + template <class T> constexpr bool is_nothrow_move_assignable_v + = is_nothrow_move_assignable<T>::value; + template <class T> constexpr bool is_nothrow_destructible_v + = is_nothrow_destructible<T>::value; + template <class T> constexpr bool has_virtual_destructor_v + = has_virtual_destructor<T>::value; + + // See C++14 20.10.5, type property queries + template <class T> constexpr size_t alignment_of_v + = alignment_of<T>::value; + template <class T> constexpr size_t rank_v + = rank<T>::value; + template <class T, unsigned I = 0> constexpr size_t extent_v + = extent<T, I>::value; + + // See C++14 20.10.6, type relations + template <class T, class U> constexpr bool is_same_v + = is_same<T, U>::value; + template <class Base, class Derived> constexpr bool is_base_of_v + = is_base_of<Base, Derived>::value; + template <class From, class To> constexpr bool is_convertible_v + = is_convertible<From, To>::value; + + // 3.3.2, Other type transformations + template <class> class invocation_type; // not defined + template <class F, class... ArgTypes> class invocation_type<F(ArgTypes...)>; + template <class> class raw_invocation_type; // not defined + template <class F, class... ArgTypes> class raw_invocation_type<F(ArgTypes...)>; + + template <class T> + using invocation_type_t = typename invocation_type<T>::type; + template <class T> + using raw_invocation_type_t = typename raw_invocation_type<T>::type; + +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +#include <experimental/__config> + +#if _LIBCPP_STD_VER > 11 + +#include <type_traits> + +_LIBCPP_BEGIN_NAMESPACE_LFTS + +#if __has_feature(cxx_variable_templates) + +// C++14 20.10.4.1, primary type categories + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v + = is_void<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v + = is_null_pointer<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v + = is_integral<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v + = is_floating_point<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v + = is_array<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v + = is_pointer<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v + = is_lvalue_reference<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v + = is_rvalue_reference<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v + = is_member_object_pointer<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v + = is_member_function_pointer<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v + = is_enum<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v + = is_union<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v + = is_class<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v + = is_function<_Tp>::value; + +// C++14 20.10.4.2, composite type categories + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v + = is_reference<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v + = is_arithmetic<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v + = is_fundamental<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v + = is_object<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v + = is_scalar<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v + = is_compound<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v + = is_member_pointer<_Tp>::value; + +// C++14 20.10.4.3, type properties + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v + = is_const<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v + = is_volatile<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v + = is_trivial<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v + = is_trivially_copyable<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v + = is_standard_layout<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v + = is_pod<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v + = is_literal_type<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v + = is_empty<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v + = is_polymorphic<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v + = is_abstract<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v + = is_final<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v + = is_signed<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v + = is_unsigned<_Tp>::value; + +template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_constructible_v + = is_constructible<_Tp, _Ts...>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v + = is_default_constructible<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v + = is_copy_constructible<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v + = is_move_constructible<_Tp>::value; + +template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_assignable_v + = is_assignable<_Tp, _Up>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v + = is_copy_assignable<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v + = is_move_assignable<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v + = is_destructible<_Tp>::value; + +template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v + = is_trivially_constructible<_Tp, _Ts...>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v + = is_trivially_default_constructible<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v + = is_trivially_copy_constructible<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v + = is_trivially_move_constructible<_Tp>::value; + +template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v + = is_trivially_assignable<_Tp, _Up>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v + = is_trivially_copy_assignable<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v + = is_trivially_move_assignable<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v + = is_trivially_destructible<_Tp>::value; + +template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v + = is_nothrow_constructible<_Tp, _Ts...>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v + = is_nothrow_default_constructible<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v + = is_nothrow_copy_constructible<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v + = is_nothrow_move_constructible<_Tp>::value; + +template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v + = is_nothrow_assignable<_Tp, _Up>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v + = is_nothrow_copy_assignable<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v + = is_nothrow_move_assignable<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v + = is_nothrow_destructible<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v + = has_virtual_destructor<_Tp>::value; + +// C++14 20.10.5, type properties queries + +template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v + = alignment_of<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR size_t rank_v + = rank<_Tp>::value; + +template <class _Tp, unsigned _Id = 0> _LIBCPP_CONSTEXPR size_t extent_v + = extent<_Tp, _Id>::value; + +// C++14 20.10.6, type relations + +template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v + = is_same<_Tp, _Up>::value; + +template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_base_of_v + = is_base_of<_Tp, _Up>::value; + +template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_convertible_v + = is_convertible<_Tp, _Up>::value; + +#endif /* __has_feature(cxx_variable_templates) */ + +// 3.3.2, Other type transformations +/* +template <class> +class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type; + +template <class _Fn, class ..._Args> +class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type<_Fn(_Args...)>; + +template <class> +class _LIBCPP_TYPE_VIS_ONLY invokation_type; + +template <class _Fn, class ..._Args> +class _LIBCPP_TYPE_VIS_ONLY invokation_type<_Fn(_Args...)>; + +template <class _Tp> +using invokation_type_t = typename invokation_type<_Tp>::type; + +template <class _Tp> +using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type; +*/ + +_LIBCPP_END_NAMESPACE_LFTS + +#endif /* _LIBCPP_STD_VER > 11 */ + +#endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */ diff --git a/contrib/libc++/include/experimental/utility b/contrib/libc++/include/experimental/utility new file mode 100644 index 0000000..84e461a --- /dev/null +++ b/contrib/libc++/include/experimental/utility @@ -0,0 +1,44 @@ +// -*- C++ -*- +//===-------------------------- utility ----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_EXPERIMENTAL_UTILITY +#define _LIBCPP_EXPERIMENTAL_UTILITY + +/* + experimental/utility synopsis + +// C++1y + +#include <utility> + +namespace std { +namespace experimental { +inline namespace fundamentals_v1 { + + 3.1.2, erased-type placeholder + struct erased_type { }; + +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +# include <experimental/__config> + +# include <utility> + +_LIBCPP_BEGIN_NAMESPACE_LFTS + + struct _LIBCPP_TYPE_VIS_ONLY erased_type { }; + +_LIBCPP_END_NAMESPACE_LFTS + +#endif /* _LIBCPP_EXPERIMENTAL_UTILITY */ |