diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-09-16 22:26:52 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-09-16 22:26:52 +0000 |
commit | 854fa44b6f7a32ff94c2a705691da6d3b703574a (patch) | |
tree | aaccdba1a8c990ea730287a164e76e70733b424a /contrib/libc++/include/experimental | |
parent | 0e1e5c22c20e636264ff1284083c6af7a1b282cb (diff) | |
parent | 61b9a7258a7693d7f3674a5a1daf7b036ff1d382 (diff) |
Update libc++ to 3.7.0 release.
Notes
Notes:
svn path=/projects/clang370-import/; revision=287877
Diffstat (limited to 'contrib/libc++/include/experimental')
-rw-r--r-- | contrib/libc++/include/experimental/__config | 8 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/algorithm | 114 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/chrono | 59 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/dynarray | 2 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/ratio | 77 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/string_view | 9 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/system_error | 63 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/tuple | 81 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/type_traits | 8 | ||||
-rw-r--r-- | contrib/libc++/include/experimental/utility | 7 |
10 files changed, 418 insertions, 10 deletions
diff --git a/contrib/libc++/include/experimental/__config b/contrib/libc++/include/experimental/__config index 684a3b4d83d8..f64a3a90cd12 100644 --- a/contrib/libc++/include/experimental/__config +++ b/contrib/libc++/include/experimental/__config @@ -13,6 +13,10 @@ #include <__config> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + #define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace std { namespace experimental { #define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } } #define _VSTD_EXPERIMENTAL std::experimental @@ -21,4 +25,8 @@ #define _LIBCPP_END_NAMESPACE_LFTS } } } #define _VSTD_LFTS _VSTD_EXPERIMENTAL::fundamentals_v1 +#define _LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS _LIBCPP_BEGIN_NAMESPACE_STD \ + namespace chrono { namespace experimental { inline namespace fundamentals_v1 { +#define _LIBCPP_END_NAMESPACE_CHRONO_LFTS _LIBCPP_END_NAMESPACE_STD } } } + #endif diff --git a/contrib/libc++/include/experimental/algorithm b/contrib/libc++/include/experimental/algorithm new file mode 100644 index 000000000000..a2e956f281a0 --- /dev/null +++ b/contrib/libc++/include/experimental/algorithm @@ -0,0 +1,114 @@ +// -*- C++ -*- +//===-------------------------- algorithm ---------------------------------===// +// +// 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_ALGORITHM +#define _LIBCPP_EXPERIMENTAL_ALGORITHM + +/* + experimental/algorithm synopsis + +#include <algorithm> + +namespace std { +namespace experimental { +inline namespace fundamentals_v1 { + +template <class ForwardIterator, class Searcher> +ForwardIterator search(ForwardIterator first, ForwardIterator last, + const Searcher &searcher); +template <class PopulationIterator, class SampleIterator, class Distance, + class UniformRandomNumberGenerator> +SampleIterator sample(PopulationIterator first, PopulationIterator last, + SampleIterator out, Distance n, + UniformRandomNumberGenerator &&g); + +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + +*/ + +#include <experimental/__config> +#include <algorithm> +#include <type_traits> + +#include <__undef_min_max> + +#include <__debug> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS + + +template <class _PopulationIterator, class _SampleIterator, class _Distance, + class _UniformRandomNumberGenerator> +_LIBCPP_INLINE_VISIBILITY +_SampleIterator __sample(_PopulationIterator __first, + _PopulationIterator __last, _SampleIterator __out, + _Distance __n, + _UniformRandomNumberGenerator &&__g, + input_iterator_tag) { + + _Distance __k = 0; + for (; __first != __last && __k < __n; ++__first, (void)++__k) + __out[__k] = *__first; + _Distance __sz = __k; + for (; __first != __last; ++__first, (void)++__k) { + _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g); + if (__r < __sz) + __out[__r] = *__first; + } + return __out + _VSTD::min(__n, __k); +} + +template <class _PopulationIterator, class _SampleIterator, class _Distance, + class _UniformRandomNumberGenerator> +_LIBCPP_INLINE_VISIBILITY +_SampleIterator __sample(_PopulationIterator __first, + _PopulationIterator __last, _SampleIterator __out, + _Distance __n, + _UniformRandomNumberGenerator &&__g, + forward_iterator_tag) { + _Distance __unsampled_sz = _VSTD::distance(__first, __last); + for (__n = _VSTD::min(__n, __unsampled_sz); __n != 0; ++__first) { + _Distance __r = + _VSTD::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g); + if (__r < __n) { + *__out++ = *__first; + --__n; + } + } + return __out; +} + +template <class _PopulationIterator, class _SampleIterator, class _Distance, + class _UniformRandomNumberGenerator> +_LIBCPP_INLINE_VISIBILITY +_SampleIterator sample(_PopulationIterator __first, + _PopulationIterator __last, _SampleIterator __out, + _Distance __n, _UniformRandomNumberGenerator &&__g) { + typedef typename iterator_traits<_PopulationIterator>::iterator_category + _PopCategory; + typedef typename iterator_traits<_PopulationIterator>::difference_type + _Difference; + typedef typename common_type<_Distance, _Difference>::type _CommonType; + _LIBCPP_ASSERT(__n >= 0, "N must be a positive number."); + return _VSTD_LFTS::__sample( + __first, __last, __out, _CommonType(__n), + _VSTD::forward<_UniformRandomNumberGenerator>(__g), + _PopCategory()); +} + +_LIBCPP_END_NAMESPACE_LFTS + +#endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */ diff --git a/contrib/libc++/include/experimental/chrono b/contrib/libc++/include/experimental/chrono new file mode 100644 index 000000000000..ca9e5f852ea2 --- /dev/null +++ b/contrib/libc++/include/experimental/chrono @@ -0,0 +1,59 @@ +// -*- C++ -*- +//===------------------------------ chrono ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_EXPERIMENTAL_CHRONO +#define _LIBCPP_EXPERIMENTAL_CHRONO + +/** + experimental/chrono synopsis + +// C++1y + +#include <chrono> + +namespace std { +namespace chrono { +namespace experimental { +inline namespace fundamentals_v1 { + + // See C++14 20.12.4, customization traits + template <class Rep> constexpr bool treat_as_floating_point_v + = treat_as_floating_point<Rep>::value; + +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace chrono +} // namespace std + + */ + +#include <experimental/__config> +#include <chrono> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 11 + +_LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS + +#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES + +template <class _Rep> _LIBCPP_CONSTEXPR bool treat_as_floating_point_v + = treat_as_floating_point<_Rep>::value; + +#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */ + +_LIBCPP_END_NAMESPACE_CHRONO_LFTS + +#endif /* _LIBCPP_STD_VER > 11 */ + +#endif /* _LIBCPP_EXPERIMENTAL_CHRONO */ diff --git a/contrib/libc++/include/experimental/dynarray b/contrib/libc++/include/experimental/dynarray index 0bc8dfe2cb7b..a0258628dfa6 100644 --- a/contrib/libc++/include/experimental/dynarray +++ b/contrib/libc++/include/experimental/dynarray @@ -104,6 +104,8 @@ public: #include <new> #include <algorithm> +#include <__undef___deallocate> + #if defined(_LIBCPP_NO_EXCEPTIONS) #include <cassert> #endif diff --git a/contrib/libc++/include/experimental/ratio b/contrib/libc++/include/experimental/ratio new file mode 100644 index 000000000000..757f24e08614 --- /dev/null +++ b/contrib/libc++/include/experimental/ratio @@ -0,0 +1,77 @@ +// -*- C++ -*- +//===------------------------------ ratio ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_EXPERIMENTAL_RATIO +#define _LIBCPP_EXPERIMENTAL_RATIO + +/** + experimental/ratio synopsis + C++1y +#include <ratio> + +namespace std { +namespace experimental { +inline namespace fundamentals_v1 { + + // See C++14 20.11.5, ratio comparison + template <class R1, class R2> constexpr bool ratio_equal_v + = ratio_equal<R1, R2>::value; + template <class R1, class R2> constexpr bool ratio_not_equal_v + = ratio_not_equal<R1, R2>::value; + template <class R1, class R2> constexpr bool ratio_less_v + = ratio_less<R1, R2>::value; + template <class R1, class R2> constexpr bool ratio_less_equal_v + = ratio_less_equal<R1, R2>::value; + template <class R1, class R2> constexpr bool ratio_greater_v + = ratio_greater<R1, R2>::value; + template <class R1, class R2> constexpr bool ratio_greater_equal_v + = ratio_greater_equal<R1, R2>::value; + +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + +*/ + +#include <experimental/__config> + +#if _LIBCPP_STD_VER > 11 + +#include <ratio> + +_LIBCPP_BEGIN_NAMESPACE_LFTS + +#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES + +template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_equal_v + = ratio_equal<_R1, _R2>::value; + +template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_not_equal_v + = ratio_not_equal<_R1, _R2>::value; + +template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_v + = ratio_less<_R1, _R2>::value; + +template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_equal_v + = ratio_less_equal<_R1, _R2>::value; + +template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_v + = ratio_greater<_R1, _R2>::value; + +template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_equal_v + = ratio_greater_equal<_R1, _R2>::value; + +#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */ + +_LIBCPP_END_NAMESPACE_LFTS + +#endif /* _LIBCPP_STD_VER > 11 */ + +#endif // _LIBCPP_EXPERIMENTAL_RATIO diff --git a/contrib/libc++/include/experimental/string_view b/contrib/libc++/include/experimental/string_view index d423f39003a5..2a20d7caa687 100644 --- a/contrib/libc++/include/experimental/string_view +++ b/contrib/libc++/include/experimental/string_view @@ -280,11 +280,8 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS const_reference at(size_type __pos) const { return __pos >= size() - ? throw out_of_range("string_view::at") + ? (throw out_of_range("string_view::at"), __data[0]) : __data[__pos]; -// if (__pos >= size()) -// throw out_of_range("string_view::at"); -// return __data[__pos]; } _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY @@ -313,7 +310,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS _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()"); + _LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()"); __data += __n; __size -= __n; } @@ -321,7 +318,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS _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()"); + _LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()"); __size -= __n; } diff --git a/contrib/libc++/include/experimental/system_error b/contrib/libc++/include/experimental/system_error new file mode 100644 index 000000000000..2ec238544615 --- /dev/null +++ b/contrib/libc++/include/experimental/system_error @@ -0,0 +1,63 @@ +// -*- C++ -*- +//===-------------------------- system_error ------------------------------===// +// +// 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_SYSTEM_ERROR +#define _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR + +/** + experimental/system_error synopsis + +// C++1y + +#include <system_error> + +namespace std { +namespace experimental { +inline namespace fundamentals_v1 { + + // See C++14 19.5, System error support + template <class T> constexpr bool is_error_code_enum_v + = is_error_code_enum<T>::value; + template <class T> constexpr bool is_error_condition_enum_v + = is_error_condition_enum<T>::value; + +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + +*/ + +#include <experimental/__config> + +#if _LIBCPP_STD_VER > 11 + +#include <system_error> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS + +#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_code_enum_v + = is_error_code_enum<_Tp>::value; + +template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_condition_enum_v + = is_error_condition_enum<_Tp>::value; + +#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */ + +_LIBCPP_END_NAMESPACE_LFTS + +#endif /* _LIBCPP_STD_VER > 11 */ + +#endif /* _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR */ diff --git a/contrib/libc++/include/experimental/tuple b/contrib/libc++/include/experimental/tuple new file mode 100644 index 000000000000..50d1e0555bc4 --- /dev/null +++ b/contrib/libc++/include/experimental/tuple @@ -0,0 +1,81 @@ +// -*- C++ -*- +//===----------------------------- tuple ----------------------------------===// +// +// 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_TUPLE +#define _LIBCPP_EXPERIMENTAL_TUPLE + +/* + experimental/tuple synopsis + +// C++1y + +#include <tuple> + +namespace std { +namespace experimental { +inline namespace fundamentals_v1 { + + // See C++14 20.4.2.5, tuple helper classes + template <class T> constexpr size_t tuple_size_v + = tuple_size<T>::value; + + // 3.2.2, Calling a function with a tuple of arguments + template <class F, class Tuple> + constexpr decltype(auto) apply(F&& f, Tuple&& t); + +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + + */ + +# include <experimental/__config> + +#if _LIBCPP_STD_VER > 11 + +# include <tuple> +# include <utility> +# include <__functional_base> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_LFTS + +#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES +template <class _Tp> +_LIBCPP_CONSTEXPR size_t tuple_size_v = tuple_size<_Tp>::value; +#endif + +template <class _Fn, class _Tuple, size_t ..._Id> +inline _LIBCPP_INLINE_VISIBILITY +decltype(auto) __apply_tuple_impl(_Fn && __f, _Tuple && __t, + integer_sequence<size_t, _Id...>) { + return _VSTD::__invoke( + _VSTD::forward<_Fn>(__f), + _VSTD::get<_Id>(_VSTD::forward<_Tuple>(__t))... + ); +} + +template <class _Fn, class _Tuple> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +decltype(auto) apply(_Fn && __f, _Tuple && __t) { + return _VSTD_LFTS::__apply_tuple_impl( + _VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t), + make_index_sequence<tuple_size<typename decay<_Tuple>::type>::value>() + ); +} + +_LIBCPP_END_NAMESPACE_LFTS + +#endif /* _LIBCPP_STD_VER > 11 */ + +#endif /* _LIBCPP_EXPERIMENTAL_TUPLE */ diff --git a/contrib/libc++/include/experimental/type_traits b/contrib/libc++/include/experimental/type_traits index ab2c8cdf81d6..ae49fc176c01 100644 --- a/contrib/libc++/include/experimental/type_traits +++ b/contrib/libc++/include/experimental/type_traits @@ -184,9 +184,13 @@ inline namespace fundamentals_v1 { #include <type_traits> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + _LIBCPP_BEGIN_NAMESPACE_LFTS -#if __has_feature(cxx_variable_templates) +#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES // C++14 20.10.4.1, primary type categories @@ -393,7 +397,7 @@ template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_base_of_v template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_convertible_v = is_convertible<_Tp, _Up>::value; -#endif /* __has_feature(cxx_variable_templates) */ +#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */ // 3.3.2, Other type transformations /* diff --git a/contrib/libc++/include/experimental/utility b/contrib/libc++/include/experimental/utility index 84e461af073f..b5fca6c775bc 100644 --- a/contrib/libc++/include/experimental/utility +++ b/contrib/libc++/include/experimental/utility @@ -31,9 +31,12 @@ inline namespace fundamentals_v1 { */ -# include <experimental/__config> +#include <experimental/__config> +#include <utility> -# include <utility> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_LFTS |