Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterFeicht committed Feb 22, 2020
2 parents 8184005 + 6e7624c commit a676687
Show file tree
Hide file tree
Showing 72 changed files with 2,489 additions and 590 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,4 @@ source:
https://en.cppreference.com/w/ ; \
popd > /dev/null

./export.py --url=http://en.cppreference.com/mwiki reference/cppreference-export-ns0,4,8,10.xml 0 4 8 10
./export.py --url=https://en.cppreference.com/mwiki reference/cppreference-export-ns0,4,8,10.xml 0 4 8 10
32 changes: 17 additions & 15 deletions headers/README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@

Information
-----------

This directory contains dummy C++ standard library that contains only the
declarations of the C++ standard library interface, to be used as an aid in
code completion.

Real standard library implementations often use complex C++ techniques in order
to provide full compliance and perform optimizations. This leads to code
completion implementations being unable to resolve typedef result and function
return types, and thus being unable to provide code completion of class members
when given instance variable. This issue becomes more and more important with
Real standard library implementations often use complex C++ techniques in order
to provide full compliance and perform optimizations. This leads to code
completion implementations being unable to resolve typedef result and function
return types, and thus being unable to provide code completion of class members
when given instance variable. This issue becomes more and more important with
widespread use of C++ 'auto' type specifier, because code completion of members
of such variables depend on function return types being correctly resolved.

This dummy library performs various steps to simplify the exposed interface, to
make code completion more useful. In addition to that, descriptive parameter
names are exposed instead of uglified identifiers used in real standard library
implementations. The parameter names correspond to those provided for
implementations. The parameter names correspond to those provided for
respective functions in the cppreference.com C++ reference.

To simplify, noexcept specifiers are omitted from declarations.

Configuration
-------------

The exposed interface depends on the values of the following preprocessor
The exposed interface depends on the values of the following preprocessor
macros:

- CPPREFERENCE_STDVER: defines the standard version of the interface. Possible
values are 1998, 2003, 2011, 2014, 2017 which correspond to the respective
C++ standards.
- CPPREFERENCE_SIMPLIFY_TYPEDEFS: non-zero value results in simplified
typedefs being exposed. Usage of various traits is greatly reduced; the
typedefs refer to types that would be resolved in most common cases.

- CPPREFERENCE_SIMPLIFY_TYPEDEFS: non-zero value results in simplified
typedefs being exposed. Usage of various traits is greatly reduced; the
typedefs refer to types that would be resolved in most common cases.
Enabling this is recommended.

Usage
-----

The primary target for this dummy C++ standard library is the Qt Creator IDE,
The primary target for this dummy C++ standard library is the Qt Creator IDE,
though the code might be useful in other IDEs.

For each Qt Creator project, perform the following steps to replace the
For each Qt Creator project, perform the following steps to replace the
C++ library used by code completion:

- Add the path to this directory to the $PROJECT.includes file

- Define CPPREFERENCE_STDVER and/or CPPREFERENCE_SIMPLIFY_TYPEDEFS to correct
values in the $PROJECT.config file.
values in the $PROJECT.config file.
162 changes: 124 additions & 38 deletions headers/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <initializer_list>
#endif
#include <utility> // for std::pair
#include <iterator> // for std::iterator_traits

namespace std {

Expand All @@ -38,36 +39,80 @@ UnaryFunction for_each(InputIt first, InputIt last, UnaryFunction f);

template<class InputIt, class T >
typename iterator_traits<InputIt>::difference_type
count(InputIt first, InputIt last, const T& value);
count(InputIt first, InputIt last, const T& value);

template<class InputIt, class UnaryPredicate >
typename iterator_traits<InputIt>::difference_type
count_if(InputIt first, InputIt last, UnaryPredicate p);
count_if(InputIt first, InputIt last, UnaryPredicate p);

#if CPPREFERENCE_STDVER >= 2020
template<class InputIt1, class InputIt2 >
std::pair<InputIt1, InputIt2>
mismatch(InputIt1 first1, InputIt1 last1,
InputIt2 first2);
constexpr mismatch(InputIt1 first1, InputIt1 last1,
InputIt2 first2);

template<class InputIt1, class InputIt2, class BinaryPredicate >
std::pair<InputIt1, InputIt2>
mismatch(InputIt1 first1, InputIt1 last1,
InputIt2 first2,
BinaryPredicate p);
constexpr mismatch(InputIt1 first1, InputIt1 last1,
InputIt2 first2,
BinaryPredicate p);
#else
template<class InputIt1, class InputIt2 >
std::pair<InputIt1, InputIt2>
mismatch(InputIt1 first1, InputIt1 last1,
InputIt2 first2);

template<class InputIt1, class InputIt2, class BinaryPredicate >
std::pair<InputIt1, InputIt2>
mismatch(InputIt1 first1, InputIt1 last1,
InputIt2 first2,
BinaryPredicate p);
#endif

#if CPPREFERENCE_STDVER >= 2017
template<class ExecutionPolicy, class InputIt1, class InputIt2 >
std::pair<InputIt1, InputIt2>
mismatch(ExecutionPolicy&& policy,
InputIt1 first1, InputIt1 last1,
InputIt2 first2);

template<class ExecutionPolicy, class InputIt1, class InputIt2, class BinaryPredicate >
std::pair<InputIt1, InputIt2>
mismatch(ExecutionPolicy&& policy,
InputIt1 first1, InputIt1 last1,
InputIt2 first2,
BinaryPredicate p);
#endif

#if CPPREFERENCE_STDVER >= 2014
template<class InputIt1, class InputIt2 >
std::pair<InputIt1, InputIt2>
mismatch(InputIt1 first1, InputIt1 last1,
InputIt2 first2, InputIt2 last2);
mismatch(InputIt1 first1, InputIt1 last1,
InputIt2 first2, InputIt2 last2);

template<class InputIt1, class InputIt2, class BinaryPredicate >
std::pair<InputIt1, InputIt2>
mismatch(InputIt1 first1, InputIt1 last1,
InputIt2 first2, InputIt2 last2,
BinaryPredicate p);
mismatch(InputIt1 first1, InputIt1 last1,
InputIt2 first2, InputIt2 last2,
BinaryPredicate p);
#endif

#if CPPREFERENCE_STDVER >= 2017
template<class ExecutionPolicy, class InputIt1, class InputIt2 >
std::pair<InputIt1, InputIt2>
mismatch(ExecutionPolicy&& policy,
InputIt1 first1, InputIt1 last1,
InputIt2 first2, InputIt2 last2);

template<class ExecutionPolicy, class InputIt1, class InputIt2, class BinaryPredicate >
std::pair<InputIt1, InputIt2>
mismatch(ExecutionPolicy&& policy,
InputIt1 first1, InputIt1 last1,
InputIt2 first2, InputIt2 last2,
BinaryPredicate p);
#endif


template<class InputIt1, class InputIt2 >
bool equal(InputIt1 first1, InputIt1 last1,
InputIt2 first2);
Expand All @@ -87,6 +132,29 @@ bool equal(InputIt1 first1, InputIt1 last1,
BinaryPredicate p);
#endif

#if CPPREFERENCE_STDVER >= 2017
template<class ExecutionPolicy, class InputIt1, class InputIt2 >
bool equal(ExecutionPolicy&& policy,
InputIt1 first1, InputIt1 last1,
InputIt2 first2);

template<class ExecutionPolicy, class InputIt1, class InputIt2, class BinaryPredicate >
bool equal(ExecutionPolicy&& policy,
InputIt1 first1, InputIt1 last1,
InputIt2 first2, BinaryPredicate p);

template<class ExecutionPolicy, class InputIt1, class InputIt2 >
bool equal(ExecutionPolicy&& policy,
InputIt1 first1, InputIt1 last1,
InputIt2 first2, InputIt2 last2);

template<class ExecutionPolicy, class InputIt1, class InputIt2, class BinaryPredicate >
bool equal(ExecutionPolicy&& policy,
InputIt1 first1, InputIt1 last1,
InputIt2 first2, InputIt2 last2,
BinaryPredicate p);
#endif

template<class InputIt, class T >
InputIt find(InputIt first, InputIt last, const T& value);

Expand Down Expand Up @@ -555,32 +623,32 @@ template<class ForwardIt, class Compare >
constexpr ForwardIt max_element(ForwardIt first, ForwardIt last, Compare cmp);
#endif

#if CPPREFERENCE_STDVER <2014
#if CPPREFERENCE_STDVER >= 2014
template<class T >
const T& min(const T& a, const T& b);
constexpr const T& min(const T& a, const T& b);

template<class T, class Compare >
const T& min(const T& a, const T& b, Compare comp);
constexpr const T& min(const T& a, const T& b, Compare comp);
#else
template<class T >
constexpr const T& min(const T& a, const T& b);
const T& min(const T& a, const T& b);

template<class T, class Compare >
constexpr const T& min(const T& a, const T& b, Compare comp);
const T& min(const T& a, const T& b, Compare comp);
#endif

#if CPPREFERENCE_STDVER >= 2011
#if CPPREFERENCE_STDVER >= 2014
template<class T >
T min(std::initializer_list<T> ilist);
constexpr T min(std::initializer_list<T> ilist);

template<class T, class Compare >
T min(std::initializer_list<T> ilist, Compare comp);
#elif CPPREFERENCE_STDVER >= 2014
constexpr T min(std::initializer_list<T> ilist, Compare comp);
#elif CPPREFERENCE_STDVER >= 2011
template<class T >
constexpr T min(std::initializer_list<T> ilist);
T min(std::initializer_list<T> ilist);

template<class T, class Compare >
constexpr T min(std::initializer_list<T> ilist, Compare comp);
T min(std::initializer_list<T> ilist, Compare comp);
#endif

#if CPPREFERENCE_STDVER <2017
Expand All @@ -597,32 +665,32 @@ template<class ForwardIt, class Compare >
constexpr ForwardIt min_element(ForwardIt first, ForwardIt last, Compare cmp);
#endif

#if CPPREFERENCE_STDVER >= 2011 && CPPREFERENCE_STDVER <2014
#if CPPREFERENCE_STDVER >= 2014
template<class T >
std::pair<const T&, const T&> minmax(const T& a, const T& b);
constexpr std::pair<const T&, const T&> minmax(const T& a, const T& b);

template<class T, class Compare >
std::pair<const T&, const T&> minmax(const T& a, const T& b,
Compare comp);

constexpr std::pair<const T&, const T&> minmax(const T& a, const T& b,
Compare comp);
template<class T >
std::pair<T, T> minmax(std::initializer_list<T> ilist);
constexpr std::pair<T, T> minmax(std::initializer_list<T> ilist);

template<class T, class Compare >
std::pair<T, T> minmax(std::initializer_list<T> ilist, Compare comp);
constexpr std::pair<T, T> minmax(std::initializer_list<T> ilist, Compare comp);

#elif CPPREFERENCE_STDVER >= 2014
#elif CPPREFERENCE_STDVER >= 2011
template<class T >
constexpr std::pair<const T&, const T&> minmax(const T& a, const T& b);
std::pair<const T&, const T&> minmax(const T& a, const T& b);

template<class T, class Compare >
constexpr std::pair<const T&, const T&> minmax(const T& a, const T& b,
Compare comp);
std::pair<const T&, const T&> minmax(const T& a, const T& b,
Compare comp);

template<class T >
constexpr std::pair<T, T> minmax(std::initializer_list<T> ilist);
std::pair<T, T> minmax(std::initializer_list<T> ilist);

template<class T, class Compare >
constexpr std::pair<T, T> minmax(std::initializer_list<T> ilist, Compare comp);
std::pair<T, T> minmax(std::initializer_list<T> ilist, Compare comp);
#endif

#if CPPREFERENCE_STDVER >= 2011 && CPPREFERENCE_STDVER <2017
Expand Down Expand Up @@ -652,7 +720,15 @@ bool lexicographical_compare(InputIt1 first1, InputIt1 last1,
InputIt2 first2, InputIt2 last2,
Compare comp);

#if CPPREFERENCE_STDVER >= 2011
#if CPPREFERENCE_STDVER >= 2020
template<class ForwardIt1, class ForwardIt2 >
constexpr bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
ForwardIt2 first2);

template<class ForwardIt1, class ForwardIt2, class BinaryPredicate >
constexpr bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
ForwardIt2 first2, BinaryPredicate p);
#elif CPPREFERENCE_STDVER >= 2011
template<class ForwardIt1, class ForwardIt2 >
bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
ForwardIt2 first2);
Expand All @@ -662,7 +738,17 @@ bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
ForwardIt2 first2, BinaryPredicate p);
#endif

#if CPPREFERENCE_STDVER >= 2011
#if CPPREFERENCE_STDVER >= 2020
template<class ForwardIt1, class ForwardIt2 >
constexpr bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
ForwardIt2 first2, ForwardIt2 last2);

template<class ForwardIt1, class ForwardIt2, class BinaryPredicate >
constexpr bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
ForwardIt2 first2, ForwardIt2 last2,
BinaryPredicate p);

#elif CPPREFERENCE_STDVER >= 2011
template<class ForwardIt1, class ForwardIt2 >
bool is_permutation(ForwardIt1 first1, ForwardIt1 last1,
ForwardIt2 first2, ForwardIt2 last2);
Expand Down
Loading

0 comments on commit a676687

Please sign in to comment.