Skip to content

Commit 60c5508

Browse files
committed
CRLF->LF
1 parent 6c0ca35 commit 60c5508

44 files changed

Lines changed: 3031 additions & 3023 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# LF in the repository and in the working tree, on every platform, so that what is on disk is byte-for-byte what is
2+
# committed. This only ever acts when something writes CRLF, which `git add` then normalizes back; text=auto keeps
3+
# git's hands off the binaries rather than corrupting them.
4+
* text=auto eol=lf
5+
6+
# cmd.exe is unreliable reading LF-only batch files, notably around goto and its labels, so these alone are CRLF on
7+
# disk. Their blobs are still LF, as git stores every text file.
8+
*.bat text eol=crlf

.gitignore

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Build results
2-
[Dd]ebug/
3-
[Rr]elease/
4-
/tests/.qtc_clangd/
5-
/.qmake.stash
6-
/Makefile
7-
/Makefile.*
8-
/*.vcxproj*
9-
10-
# Visual Studio 2015 cache/options directory
11-
.vs/
12-
# Uncomment if you have tasks that create the project's static files in wwwroot
13-
#wwwroot/
1+
# Build results
2+
[Dd]ebug/
3+
[Rr]elease/
4+
/tests/.qtc_clangd/
5+
/.qmake.stash
6+
/Makefile
7+
/Makefile.*
8+
/*.vcxproj*
9+
10+
# Visual Studio 2015 cache/options directory
11+
.vs/
12+
# Uncomment if you have tasks that create the project's static files in wwwroot
13+
#wwwroot/
Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,100 @@
1-
#pragma once
2-
3-
#define UNUSED_VARIABLE(x) (void)(x)
4-
5-
#if defined _MSC_VER
6-
7-
#define COMPILER_PRAGMA(text) __pragma(text)
8-
#define STORE_COMPILER_WARNINGS COMPILER_PRAGMA(warning(push))
9-
#define RESTORE_COMPILER_WARNINGS COMPILER_PRAGMA(warning(pop))
10-
#define DISABLE_SPECIFIC_COMPILER_WARNING(warningCode) COMPILER_PRAGMA(warning (disable: warningCode))
11-
#define DISABLE_MSVC_WARNING(warningCode) DISABLE_SPECIFIC_COMPILER_WARNING(warningCode)
12-
#define DISABLE_CLANG_GCC_WARNING(warning)
13-
#define DISABLE_GCC_WARNING(warning)
14-
15-
#elif defined __clang__
16-
17-
#define COMPILER_PRAGMA(text) _Pragma(#text) // Stringifying the text to wrap it into quotes
18-
#define STORE_COMPILER_WARNINGS COMPILER_PRAGMA(clang diagnostic push)
19-
#define RESTORE_COMPILER_WARNINGS COMPILER_PRAGMA(clang diagnostic pop)
20-
#define DISABLE_SPECIFIC_COMPILER_WARNING(warning) COMPILER_PRAGMA(clang diagnostic ignored warning)
21-
#define DISABLE_MSVC_WARNING(warningCode)
22-
#define DISABLE_CLANG_GCC_WARNING(warning) DISABLE_SPECIFIC_COMPILER_WARNING(warning)
23-
#define DISABLE_GCC_WARNING(warning)
24-
25-
#elif defined __GNUC__ || defined __GNUG__
26-
27-
#define COMPILER_PRAGMA(text) _Pragma(#text) // Stringifying the text to wrap it into quotes
28-
#define STORE_COMPILER_WARNINGS COMPILER_PRAGMA(GCC diagnostic push)
29-
#define RESTORE_COMPILER_WARNINGS COMPILER_PRAGMA(GCC diagnostic pop)
30-
#define DISABLE_SPECIFIC_COMPILER_WARNING(warning) COMPILER_PRAGMA(GCC diagnostic ignored warning)
31-
#define DISABLE_MSVC_WARNING(warningCode)
32-
#define DISABLE_CLANG_GCC_WARNING(warning) DISABLE_SPECIFIC_COMPILER_WARNING(warning)
33-
#define DISABLE_GCC_WARNING(warning) DISABLE_SPECIFIC_COMPILER_WARNING(warning)
34-
35-
#else
36-
37-
#define COMPILER_PRAGMA(text)
38-
#define DISABLE_SPECIFIC_COMPILER_WARNING(warning)
39-
#define DISABLE_MSVC_WARNING(warningCode)
40-
#define STORE_COMPILER_WARNINGS
41-
#define RESTORE_COMPILER_WARNINGS
42-
#define DISABLE_CLANG_GCC_WARNING(warning)
43-
#define DISABLE_GCC_WARNING(warning)
44-
45-
#endif
46-
47-
48-
#if defined _MSC_VER
49-
50-
#define DISABLE_COMPILER_WARNINGS COMPILER_PRAGMA(warning(push, 0)) // Set /W0
51-
52-
#elif defined __clang__
53-
54-
#define DISABLE_COMPILER_WARNINGS \
55-
STORE_COMPILER_WARNINGS \
56-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wall") \
57-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunknown-pragmas") \
58-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wcomma") \
59-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wshorten-64-to-32") \
60-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wconversion") \
61-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wdeprecated-enum-enum-conversion") \
62-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wsign-promo") \
63-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wcast-qual") \
64-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunused-const-variable") \
65-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wimplicit-fallthrough") \
66-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wconditional-uninitialized")
67-
68-
#elif defined __GNUC__ || defined __GNUG__
69-
70-
#ifdef __cplusplus
71-
72-
#define DISABLE_COMPILER_WARNINGS \
73-
STORE_COMPILER_WARNINGS \
74-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wall") \
75-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunknown-pragmas") \
76-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunused-parameter") \
77-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wsign-promo") \
78-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wconversion") \
79-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wdeprecated-enum-enum-conversion") \
80-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wcast-qual") \
81-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunused-const-variable") \
82-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wimplicit-fallthrough") \
83-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wclass-memaccess")
84-
85-
#else // C only
86-
#define DISABLE_COMPILER_WARNINGS \
87-
STORE_COMPILER_WARNINGS \
88-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wall") \
89-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunused-parameter") \
90-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wimplicit-fallthrough") \
91-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wconversion") \
92-
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunknown-pragmas")
93-
#endif
94-
#else
95-
96-
#pragma message ("Unknown compiler")
97-
98-
#define DISABLE_COMPILER_WARNINGS
99-
100-
#endif
1+
#pragma once
2+
3+
#define UNUSED_VARIABLE(x) (void)(x)
4+
5+
#if defined _MSC_VER
6+
7+
#define COMPILER_PRAGMA(text) __pragma(text)
8+
#define STORE_COMPILER_WARNINGS COMPILER_PRAGMA(warning(push))
9+
#define RESTORE_COMPILER_WARNINGS COMPILER_PRAGMA(warning(pop))
10+
#define DISABLE_SPECIFIC_COMPILER_WARNING(warningCode) COMPILER_PRAGMA(warning (disable: warningCode))
11+
#define DISABLE_MSVC_WARNING(warningCode) DISABLE_SPECIFIC_COMPILER_WARNING(warningCode)
12+
#define DISABLE_CLANG_GCC_WARNING(warning)
13+
#define DISABLE_GCC_WARNING(warning)
14+
15+
#elif defined __clang__
16+
17+
#define COMPILER_PRAGMA(text) _Pragma(#text) // Stringifying the text to wrap it into quotes
18+
#define STORE_COMPILER_WARNINGS COMPILER_PRAGMA(clang diagnostic push)
19+
#define RESTORE_COMPILER_WARNINGS COMPILER_PRAGMA(clang diagnostic pop)
20+
#define DISABLE_SPECIFIC_COMPILER_WARNING(warning) COMPILER_PRAGMA(clang diagnostic ignored warning)
21+
#define DISABLE_MSVC_WARNING(warningCode)
22+
#define DISABLE_CLANG_GCC_WARNING(warning) DISABLE_SPECIFIC_COMPILER_WARNING(warning)
23+
#define DISABLE_GCC_WARNING(warning)
24+
25+
#elif defined __GNUC__ || defined __GNUG__
26+
27+
#define COMPILER_PRAGMA(text) _Pragma(#text) // Stringifying the text to wrap it into quotes
28+
#define STORE_COMPILER_WARNINGS COMPILER_PRAGMA(GCC diagnostic push)
29+
#define RESTORE_COMPILER_WARNINGS COMPILER_PRAGMA(GCC diagnostic pop)
30+
#define DISABLE_SPECIFIC_COMPILER_WARNING(warning) COMPILER_PRAGMA(GCC diagnostic ignored warning)
31+
#define DISABLE_MSVC_WARNING(warningCode)
32+
#define DISABLE_CLANG_GCC_WARNING(warning) DISABLE_SPECIFIC_COMPILER_WARNING(warning)
33+
#define DISABLE_GCC_WARNING(warning) DISABLE_SPECIFIC_COMPILER_WARNING(warning)
34+
35+
#else
36+
37+
#define COMPILER_PRAGMA(text)
38+
#define DISABLE_SPECIFIC_COMPILER_WARNING(warning)
39+
#define DISABLE_MSVC_WARNING(warningCode)
40+
#define STORE_COMPILER_WARNINGS
41+
#define RESTORE_COMPILER_WARNINGS
42+
#define DISABLE_CLANG_GCC_WARNING(warning)
43+
#define DISABLE_GCC_WARNING(warning)
44+
45+
#endif
46+
47+
48+
#if defined _MSC_VER
49+
50+
#define DISABLE_COMPILER_WARNINGS COMPILER_PRAGMA(warning(push, 0)) // Set /W0
51+
52+
#elif defined __clang__
53+
54+
#define DISABLE_COMPILER_WARNINGS \
55+
STORE_COMPILER_WARNINGS \
56+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wall") \
57+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunknown-pragmas") \
58+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wcomma") \
59+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wshorten-64-to-32") \
60+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wconversion") \
61+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wdeprecated-enum-enum-conversion") \
62+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wsign-promo") \
63+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wcast-qual") \
64+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunused-const-variable") \
65+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wimplicit-fallthrough") \
66+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wconditional-uninitialized")
67+
68+
#elif defined __GNUC__ || defined __GNUG__
69+
70+
#ifdef __cplusplus
71+
72+
#define DISABLE_COMPILER_WARNINGS \
73+
STORE_COMPILER_WARNINGS \
74+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wall") \
75+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunknown-pragmas") \
76+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunused-parameter") \
77+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wsign-promo") \
78+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wconversion") \
79+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wdeprecated-enum-enum-conversion") \
80+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wcast-qual") \
81+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunused-const-variable") \
82+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wimplicit-fallthrough") \
83+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wclass-memaccess")
84+
85+
#else // C only
86+
#define DISABLE_COMPILER_WARNINGS \
87+
STORE_COMPILER_WARNINGS \
88+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wall") \
89+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunused-parameter") \
90+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wimplicit-fallthrough") \
91+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wconversion") \
92+
DISABLE_SPECIFIC_COMPILER_WARNING("-Wunknown-pragmas")
93+
#endif
94+
#else
95+
96+
#pragma message ("Unknown compiler")
97+
98+
#define DISABLE_COMPILER_WARNINGS
99+
100+
#endif

container/README.md

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
## A collection of algorithms and augmentations for STL-compatible containers
2-
3-
### algorithms.hpp
4-
5-
Defines two functions in `ContainerAlgorithms` namespace that are constructed upon the standard algorithms:
6-
* `void erase_all_occurrences(ContainerType& container, const ArgumentType& item)` deletes every occurrence of the `item` in `container` using the remove-erase idiom.
7-
* `void void erase_if(ContainerType& container, std::function<bool(const ItemType&)>` deletes every occurrence of the `item` in `container` using the remove-erase idiom.
8-
9-
### iterator_helpers.hpp
10-
11-
Defines two classes `const_forward_iterator_wrapper` and `forward_iterator_wrapper` that encapsulate an std (or std-compatible) iterator together with a reference to the container this iterator points to. This allows using these iterators as any other normal iterator while also being able to get the parent container from them.
12-
13-
### ordered_containers.hpp
14-
15-
Defines `ordered_container` class that wraps an STL-compatible container. It is intended for use with containers that aren't sorted by nature (e. g. vector or list as opposed to map or set), and provides three extra methods: `sort()`, `find(value)` and `insert_into_sorted(value)`. The `find` and `insert_into_sorted` methods require that container is sorted, and for such a container they provide optimized implementation using `std::lower_bound`. The `insert_into_sorted` method returns `std::pair<iterator, bool>` similar to the standard ordered containers.
16-
17-
### set_operations.hpp
18-
19-
Defines a number of algorithms on containers in `SetOperations` namespace:
20-
* `OrderedSetType longestCommonStart(SupersetType<OrderedSetType> const & superset)` takes a set of ordered containers and returns the longest common starting sequence of items between all of these ordered containers.
21-
Example 1: `longestCommonStart(std::vector{std::vector<int>{1, 2, 3, 4, 5}, std::vector<int>{1, 2, 3, 10, 20}})` -> `std::vector{1, 2}`
22-
Example 2: `longestCommonStart(std::vector{std::string("Hello"), std::string("Heat"), std::string("Home")})` -> `std::string("H")`
23-
* `template <class ContainerType> ContainerType uniqueElements(const ContainerType& c)` returns only the unique items from `c`. This function is stable (item order is preserved). Has no-op overloads for `set` and `map` which may only contain unique items by definition.
24-
* `setTheoreticDifference` takes two containers `a` and `b` and an optional comparator, and returns a container of all the elements from `a` that are not in `b`.
25-
Example: `setTheoreticDifference<std::list>(std::vector<int> {1, 2, 3}, std::deque<int> {3, 1})` -> `std::list<int> {2}`
26-
It is assumed that the containers are unordered because for ordered containers `std::set_difference` can be called directly.
27-
* `calculateDiff` takes two containers `a` and `b` and an optional template argument specifying the output container type. It returns the following structure:
28-
```template <class OutputContainerType>
29-
struct Diff
30-
{
31-
OutputContainerType common_elements;
32-
OutputContainerType elements_from_a_not_in_b;
33-
OutputContainerType elements_from_b_not_in_a;
34-
};
35-
36-
### std_container_helpers.hpp
37-
38-
Defines two functions that behave differently depending on what container they're called with:
39-
* `void add_item(Container& container, const ItemType& item)` calls `push_back(item)` for containers that have push_back (ordered containers), and `insert(item)` for other (unordered) containers.
40-
* `auto container_aware_find(Container& container, const ItemType& item)` calls `container.find(item)` for containers that have a member function `find`, calls `std::find` otherwise.
41-
42-
### string_helpers.hpp
43-
44-
Defines `bool operator==(const std::string str, const char ch)` and `bool operator==(const char ch, const std::string str)` for comparing a string with to a single character.
1+
## A collection of algorithms and augmentations for STL-compatible containers
2+
3+
### algorithms.hpp
4+
5+
Defines two functions in `ContainerAlgorithms` namespace that are constructed upon the standard algorithms:
6+
* `void erase_all_occurrences(ContainerType& container, const ArgumentType& item)` deletes every occurrence of the `item` in `container` using the remove-erase idiom.
7+
* `void void erase_if(ContainerType& container, std::function<bool(const ItemType&)>` deletes every occurrence of the `item` in `container` using the remove-erase idiom.
8+
9+
### iterator_helpers.hpp
10+
11+
Defines two classes `const_forward_iterator_wrapper` and `forward_iterator_wrapper` that encapsulate an std (or std-compatible) iterator together with a reference to the container this iterator points to. This allows using these iterators as any other normal iterator while also being able to get the parent container from them.
12+
13+
### ordered_containers.hpp
14+
15+
Defines `ordered_container` class that wraps an STL-compatible container. It is intended for use with containers that aren't sorted by nature (e. g. vector or list as opposed to map or set), and provides three extra methods: `sort()`, `find(value)` and `insert_into_sorted(value)`. The `find` and `insert_into_sorted` methods require that container is sorted, and for such a container they provide optimized implementation using `std::lower_bound`. The `insert_into_sorted` method returns `std::pair<iterator, bool>` similar to the standard ordered containers.
16+
17+
### set_operations.hpp
18+
19+
Defines a number of algorithms on containers in `SetOperations` namespace:
20+
* `OrderedSetType longestCommonStart(SupersetType<OrderedSetType> const & superset)` takes a set of ordered containers and returns the longest common starting sequence of items between all of these ordered containers.
21+
Example 1: `longestCommonStart(std::vector{std::vector<int>{1, 2, 3, 4, 5}, std::vector<int>{1, 2, 3, 10, 20}})` -> `std::vector{1, 2}`
22+
Example 2: `longestCommonStart(std::vector{std::string("Hello"), std::string("Heat"), std::string("Home")})` -> `std::string("H")`
23+
* `template <class ContainerType> ContainerType uniqueElements(const ContainerType& c)` returns only the unique items from `c`. This function is stable (item order is preserved). Has no-op overloads for `set` and `map` which may only contain unique items by definition.
24+
* `setTheoreticDifference` takes two containers `a` and `b` and an optional comparator, and returns a container of all the elements from `a` that are not in `b`.
25+
Example: `setTheoreticDifference<std::list>(std::vector<int> {1, 2, 3}, std::deque<int> {3, 1})` -> `std::list<int> {2}`
26+
It is assumed that the containers are unordered because for ordered containers `std::set_difference` can be called directly.
27+
* `calculateDiff` takes two containers `a` and `b` and an optional template argument specifying the output container type. It returns the following structure:
28+
```template <class OutputContainerType>
29+
struct Diff
30+
{
31+
OutputContainerType common_elements;
32+
OutputContainerType elements_from_a_not_in_b;
33+
OutputContainerType elements_from_b_not_in_a;
34+
};
35+
36+
### std_container_helpers.hpp
37+
38+
Defines two functions that behave differently depending on what container they're called with:
39+
* `void add_item(Container& container, const ItemType& item)` calls `push_back(item)` for containers that have push_back (ordered containers), and `insert(item)` for other (unordered) containers.
40+
* `auto container_aware_find(Container& container, const ItemType& item)` calls `container.find(item)` for containers that have a member function `find`, calls `std::find` otherwise.
41+
42+
### string_helpers.hpp
43+
44+
Defines `bool operator==(const std::string str, const char ch)` and `bool operator==(const char ch, const std::string str)` for comparing a string with to a single character.

container/algorithms.hpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
#pragma once
2-
3-
#include <algorithm>
4-
#include <utility>
5-
6-
namespace ContainerAlgorithms {
7-
8-
//
9-
// Erases all matching elements from the container
10-
//
11-
12-
template <class ContainerType, typename PredicateType>
13-
inline void erase_if(ContainerType& container, PredicateType&& unaryPredicate)
14-
{
15-
container.erase(std::remove_if(container.begin(), container.end(), std::forward<PredicateType>(unaryPredicate)), container.end());
16-
}
17-
18-
} // namespace ContainerAlgorithms
1+
#pragma once
2+
3+
#include <algorithm>
4+
#include <utility>
5+
6+
namespace ContainerAlgorithms {
7+
8+
//
9+
// Erases all matching elements from the container
10+
//
11+
12+
template <class ContainerType, typename PredicateType>
13+
inline void erase_if(ContainerType& container, PredicateType&& unaryPredicate)
14+
{
15+
container.erase(std::remove_if(container.begin(), container.end(), std::forward<PredicateType>(unaryPredicate)), container.end());
16+
}
17+
18+
} // namespace ContainerAlgorithms

0 commit comments

Comments
 (0)