blob: 3801cae4f16e9ef86ee8bc17057975d64828f022 [file] [log] [blame]
Evgeniy Stepanov732e2682015-05-13 16:55:41 +00001// -*- C++ -*-
2//===-------------------------- algorithm ---------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_EXPERIMENTAL_ALGORITHM
12#define _LIBCPP_EXPERIMENTAL_ALGORITHM
13
14/*
15 experimental/algorithm synopsis
16
17#include <algorithm>
18
19namespace std {
20namespace experimental {
21inline namespace fundamentals_v1 {
22
23template <class ForwardIterator, class Searcher>
24ForwardIterator search(ForwardIterator first, ForwardIterator last,
25 const Searcher &searcher);
26template <class PopulationIterator, class SampleIterator, class Distance,
27 class UniformRandomNumberGenerator>
28SampleIterator sample(PopulationIterator first, PopulationIterator last,
29 SampleIterator out, Distance n,
30 UniformRandomNumberGenerator &&g);
31
32} // namespace fundamentals_v1
33} // namespace experimental
34} // namespace std
35
36*/
37
38#include <experimental/__config>
39#include <algorithm>
40#include <type_traits>
41
Evgeniy Stepanov732e2682015-05-13 16:55:41 +000042#include <__debug>
43
44#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
45#pragma GCC system_header
46#endif
47
Eric Fiseliera016efb2017-05-31 22:07:49 +000048_LIBCPP_PUSH_MACROS
49#include <__undef_macros>
Evgeniy Stepanov732e2682015-05-13 16:55:41 +000050
51
Eric Fiseliera016efb2017-05-31 22:07:49 +000052_LIBCPP_BEGIN_NAMESPACE_LFTS
53
Marshall Clow81416e42015-07-20 15:40:27 +000054template <class _ForwardIterator, class _Searcher>
55_LIBCPP_INLINE_VISIBILITY
56_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
Marshall Clow28cc4dd2016-03-08 15:12:52 +000057{ return __s(__f, __l).first; }
Marshall Clow81416e42015-07-20 15:40:27 +000058
59
Evgeniy Stepanov732e2682015-05-13 16:55:41 +000060template <class _PopulationIterator, class _SampleIterator, class _Distance,
61 class _UniformRandomNumberGenerator>
Eric Fiseliere7154702016-08-28 22:14:37 +000062inline _LIBCPP_INLINE_VISIBILITY
63_SampleIterator sample(_PopulationIterator __first, _PopulationIterator __last,
Eric Fiselier5741d862017-01-07 11:27:06 +000064 _SampleIterator __output, _Distance __n,
Eric Fiseliere7154702016-08-28 22:14:37 +000065 _UniformRandomNumberGenerator &&__g) {
Eric Fiselier5741d862017-01-07 11:27:06 +000066 return _VSTD::__sample(__first, __last, __output, __n, __g);
Evgeniy Stepanov732e2682015-05-13 16:55:41 +000067}
68
69_LIBCPP_END_NAMESPACE_LFTS
70
Eric Fiseliera016efb2017-05-31 22:07:49 +000071_LIBCPP_POP_MACROS
72
Evgeniy Stepanov732e2682015-05-13 16:55:41 +000073#endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */