Skip to content

Commit 10fc452

Browse files
committed
Headers: Add part of the APIs that are available since C++14,17
1 parent e559369 commit 10fc452

File tree

14 files changed

+930
-95
lines changed

14 files changed

+930
-95
lines changed

headers/algorithm

Lines changed: 111 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ template<class InputIt, class UnaryPredicate >
4545
typename iterator_traits<InputIt>::difference_type
4646
count_if(InputIt first, InputIt last, UnaryPredicate p);
4747

48+
#if CPPREFERENCE_STDVER >= 2020
49+
template<class InputIt1, class InputIt2 >
50+
std::pair<InputIt1, InputIt2>
51+
constexpr mismatch(InputIt1 first1, InputIt1 last1,
52+
InputIt2 first2);
53+
54+
template<class InputIt1, class InputIt2, class BinaryPredicate >
55+
std::pair<InputIt1, InputIt2>
56+
constexpr mismatch(InputIt1 first1, InputIt1 last1,
57+
InputIt2 first2,
58+
BinaryPredicate p);
59+
#else
4860
template<class InputIt1, class InputIt2 >
4961
std::pair<InputIt1, InputIt2>
5062
mismatch(InputIt1 first1, InputIt1 last1,
@@ -55,6 +67,22 @@ std::pair<InputIt1, InputIt2>
5567
mismatch(InputIt1 first1, InputIt1 last1,
5668
InputIt2 first2,
5769
BinaryPredicate p);
70+
#endif
71+
72+
#if CPPREFERENCE_STDVER >= 2017
73+
template<class ExecutionPolicy, class InputIt1, class InputIt2 >
74+
std::pair<InputIt1, InputIt2>
75+
mismatch(ExecutionPolicy&& policy,
76+
InputIt1 first1, InputIt1 last1,
77+
InputIt2 first2);
78+
79+
template<class ExecutionPolicy, class InputIt1, class InputIt2, class BinaryPredicate >
80+
std::pair<InputIt1, InputIt2>
81+
mismatch(ExecutionPolicy&& policy,
82+
InputIt1 first1, InputIt1 last1,
83+
InputIt2 first2,
84+
BinaryPredicate p);
85+
#endif
5886

5987
#if CPPREFERENCE_STDVER >= 2014
6088
template<class InputIt1, class InputIt2 >
@@ -69,6 +97,22 @@ std::pair<InputIt1, InputIt2>
6997
BinaryPredicate p);
7098
#endif
7199

100+
#if CPPREFERENCE_STDVER >= 2017
101+
template<class ExecutionPolicy, class InputIt1, class InputIt2 >
102+
std::pair<InputIt1, InputIt2>
103+
mismatch(ExecutionPolicy&& policy,
104+
InputIt1 first1, InputIt1 last1,
105+
InputIt2 first2, InputIt2 last2);
106+
107+
template<class ExecutionPolicy, class InputIt1, class InputIt2, class BinaryPredicate >
108+
std::pair<InputIt1, InputIt2>
109+
mismatch(ExecutionPolicy&& policy,
110+
InputIt1 first1, InputIt1 last1,
111+
InputIt2 first2, InputIt2 last2,
112+
BinaryPredicate p);
113+
#endif
114+
115+
72116
template<class InputIt1, class InputIt2 >
73117
bool equal(InputIt1 first1, InputIt1 last1,
74118
InputIt2 first2);
@@ -88,6 +132,29 @@ bool equal(InputIt1 first1, InputIt1 last1,
88132
BinaryPredicate p);
89133
#endif
90134

135+
#if CPPREFERENCE_STDVER >= 2017
136+
template<class ExecutionPolicy, class InputIt1, class InputIt2 >
137+
bool equal(ExecutionPolicy&& policy,
138+
InputIt1 first1, InputIt1 last1,
139+
InputIt2 first2);
140+
141+
template<class ExecutionPolicy, class InputIt1, class InputIt2, class BinaryPredicate >
142+
bool equal(ExecutionPolicy&& policy,
143+
InputIt1 first1, InputIt1 last1,
144+
InputIt2 first2, BinaryPredicate p);
145+
146+
template<class ExecutionPolicy, class InputIt1, class InputIt2 >
147+
bool equal(ExecutionPolicy&& policy,
148+
InputIt1 first1, InputIt1 last1,
149+
InputIt2 first2, InputIt2 last2);
150+
151+
template<class ExecutionPolicy, class InputIt1, class InputIt2, class BinaryPredicate >
152+
bool equal(ExecutionPolicy&& policy,
153+
InputIt1 first1, InputIt1 last1,
154+
InputIt2 first2, InputIt2 last2,
155+
BinaryPredicate p);
156+
#endif
157+
91158
template<class InputIt, class T >
92159
InputIt find(InputIt first, InputIt last, const T& value);
93160

@@ -556,32 +623,32 @@ template<class ForwardIt, class Compare >
556623
constexpr ForwardIt max_element(ForwardIt first, ForwardIt last, Compare cmp);
557624
#endif
558625

559-
#if CPPREFERENCE_STDVER <2014
626+
#if CPPREFERENCE_STDVER >= 2014
560627
template<class T >
561-
const T& min(const T& a, const T& b);
628+
constexpr const T& min(const T& a, const T& b);
562629

563630
template<class T, class Compare >
564-
const T& min(const T& a, const T& b, Compare comp);
631+
constexpr const T& min(const T& a, const T& b, Compare comp);
565632
#else
566633
template<class T >
567-
constexpr const T& min(const T& a, const T& b);
634+
const T& min(const T& a, const T& b);
568635

569636
template<class T, class Compare >
570-
constexpr const T& min(const T& a, const T& b, Compare comp);
637+
const T& min(const T& a, const T& b, Compare comp);
571638
#endif
572639

573-
#if CPPREFERENCE_STDVER >= 2011
640+
#if CPPREFERENCE_STDVER >= 2014
574641
template<class T >
575-
T min(std::initializer_list<T> ilist);
642+
constexpr T min(std::initializer_list<T> ilist);
576643

577644
template<class T, class Compare >
578-
T min(std::initializer_list<T> ilist, Compare comp);
579-
#elif CPPREFERENCE_STDVER >= 2014
645+
constexpr T min(std::initializer_list<T> ilist, Compare comp);
646+
#elif CPPREFERENCE_STDVER >= 2011
580647
template<class T >
581-
constexpr T min(std::initializer_list<T> ilist);
648+
T min(std::initializer_list<T> ilist);
582649

583650
template<class T, class Compare >
584-
constexpr T min(std::initializer_list<T> ilist, Compare comp);
651+
T min(std::initializer_list<T> ilist, Compare comp);
585652
#endif
586653

587654
#if CPPREFERENCE_STDVER <2017
@@ -598,32 +665,32 @@ template<class ForwardIt, class Compare >
598665
constexpr ForwardIt min_element(ForwardIt first, ForwardIt last, Compare cmp);
599666
#endif
600667

601-
#if CPPREFERENCE_STDVER >= 2011 && CPPREFERENCE_STDVER <2014
668+
#if CPPREFERENCE_STDVER >= 2014
602669
template<class T >
603-
std::pair<const T&, const T&> minmax(const T& a, const T& b);
670+
constexpr std::pair<const T&, const T&> minmax(const T& a, const T& b);
604671

605672
template<class T, class Compare >
606-
std::pair<const T&, const T&> minmax(const T& a, const T& b,
607-
Compare comp);
608-
673+
constexpr std::pair<const T&, const T&> minmax(const T& a, const T& b,
674+
Compare comp);
609675
template<class T >
610-
std::pair<T, T> minmax(std::initializer_list<T> ilist);
676+
constexpr std::pair<T, T> minmax(std::initializer_list<T> ilist);
611677

612678
template<class T, class Compare >
613-
std::pair<T, T> minmax(std::initializer_list<T> ilist, Compare comp);
679+
constexpr std::pair<T, T> minmax(std::initializer_list<T> ilist, Compare comp);
614680

615-
#elif CPPREFERENCE_STDVER >= 2014
681+
#elif CPPREFERENCE_STDVER >= 2011
616682
template<class T >
617-
constexpr std::pair<const T&, const T&> minmax(const T& a, const T& b);
683+
std::pair<const T&, const T&> minmax(const T& a, const T& b);
618684

619685
template<class T, class Compare >
620-
constexpr std::pair<const T&, const T&> minmax(const T& a, const T& b,
621-
Compare comp);
686+
std::pair<const T&, const T&> minmax(const T& a, const T& b,
687+
Compare comp);
688+
622689
template<class T >
623-
constexpr std::pair<T, T> minmax(std::initializer_list<T> ilist);
690+
std::pair<T, T> minmax(std::initializer_list<T> ilist);
624691

625692
template<class T, class Compare >
626-
constexpr std::pair<T, T> minmax(std::initializer_list<T> ilist, Compare comp);
693+
std::pair<T, T> minmax(std::initializer_list<T> ilist, Compare comp);
627694
#endif
628695

629696
#if CPPREFERENCE_STDVER >= 2011 && CPPREFERENCE_STDVER <2017
@@ -653,7 +720,15 @@ bool lexicographical_compare(InputIt1 first1, InputIt1 last1,
653720
InputIt2 first2, InputIt2 last2,
654721
Compare comp);
655722

656-
#if CPPREFERENCE_STDVER >= 2011
723+
#if CPPREFERENCE_STDVER >= 2020
724+
template<class ForwardIt1, class ForwardIt2 >
725+
constexpr bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
726+
ForwardIt2 first2);
727+
728+
template<class ForwardIt1, class ForwardIt2, class BinaryPredicate >
729+
constexpr bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
730+
ForwardIt2 first2, BinaryPredicate p);
731+
#elif CPPREFERENCE_STDVER >= 2011
657732
template<class ForwardIt1, class ForwardIt2 >
658733
bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
659734
ForwardIt2 first2);
@@ -663,7 +738,17 @@ bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
663738
ForwardIt2 first2, BinaryPredicate p);
664739
#endif
665740

666-
#if CPPREFERENCE_STDVER >= 2011
741+
#if CPPREFERENCE_STDVER >= 2020
742+
template<class ForwardIt1, class ForwardIt2 >
743+
constexpr bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
744+
ForwardIt2 first2, ForwardIt2 last2);
745+
746+
template<class ForwardIt1, class ForwardIt2, class BinaryPredicate >
747+
constexpr bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
748+
ForwardIt2 first2, ForwardIt2 last2,
749+
BinaryPredicate p);
750+
751+
#elif CPPREFERENCE_STDVER >= 2011
667752
template<class ForwardIt1, class ForwardIt2 >
668753
bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
669754
ForwardIt2 first2, ForwardIt2 last2);

headers/array

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,48 @@ public:
5454
#endif
5555

5656
// element access
57+
#if CPPREFERENCE_STDVER >= 2017
58+
constexpr reference at(size_type n);
59+
constexpr const_reference at(size_type n) const;
60+
#else
5761
reference at(size_type n);
5862
const_reference at(size_type n) const;
59-
reference operator[](size_type n);
63+
#endif
64+
65+
#if CPPREFERENCE_STDVER >= 2017
66+
constexpr reference operator[](size_type n);
67+
#else
68+
reference operator[](size_type n);
69+
#endif
70+
#if CPPREFERENCE_STDVER >= 2014
71+
constexpr const_reference operator[](size_type n) const;
72+
#else
6073
const_reference operator[](size_type n) const;
74+
#endif
75+
76+
#if CPPREFERENCE_STDVER >= 2017
77+
constexpr reference front();
78+
#else
79+
reference front();
80+
#endif
6181

62-
reference front();
82+
#if CPPREFERENCE_STDVER >= 2014
83+
constexpr const_reference front() const;
84+
#else
6385
const_reference front() const;
64-
reference back();
86+
#endif
87+
88+
#if CPPREFERENCE_STDVER >= 2017
89+
constexpr reference back();
90+
#else
91+
reference back();
92+
#endif
93+
94+
#if CPPREFERENCE_STDVER >= 2014
95+
constexpr const_reference back() const;
96+
#else
6597
const_reference back() const;
98+
#endif
6699

67100
T* data();
68101
const T* data() const;
@@ -85,7 +118,11 @@ public:
85118

86119
bool empty() const;
87120
size_type size() const;
88-
size_type max_size() const;
121+
#if CPPREFERENCE_STDVER >= 2014
122+
constexpr size_type max_size() const;
123+
#else
124+
constexpr size_type max_size();
125+
#endif
89126

90127
void fill(const T& value);
91128

headers/chrono

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,22 @@ public:
162162
typedef typename Duration::period period;
163163
#endif
164164

165+
#if CPPREFERENCE_STDVER >= 2014
166+
constexpr time_point();
167+
constexpr explicit time_point(const duration& d);
168+
169+
template<class Duration2>
170+
constexpr time_point(const time_point<Clock, Duration2>& t);
171+
172+
constexpr duration time_since_epoch() const;
173+
#else
165174
time_point();
166175
explicit time_point(const duration& d);
167176
template<class Duration2>
168177
time_point(const time_point<Clock, Duration2>& t);
169178

170179
duration time_since_epoch() const;
180+
#endif
171181

172182
time_point& operator+=(const duration& d);
173183
time_point& operator-=(const duration& d);
@@ -217,8 +227,15 @@ template<class Clock, class Dur1, class Dur2>
217227
bool operator>=(const time_point<Clock, Dur1>& lhs,
218228
const time_point<Clock, Dur2>& rhs);
219229

230+
#if CPPREFERENCE_STDVER >= 2014
231+
template <class ToDuration, class Clock, class Duration>
232+
constexpr time_point<Clock, ToDuration> time_point_cast(
233+
const time_point<Clock, Duration>& t);
234+
#else
220235
template <class ToDuration, class Clock, class Duration>
221-
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
236+
time_point<Clock, ToDuration> time_point_cast(
237+
const time_point<Clock, Duration>& t);
238+
#endif
222239

223240
class system_clock {
224241
public:

0 commit comments

Comments
 (0)