Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd8fe19

Browse files
authored
formatting. (#55)
1 parent ccea623 commit fd8fe19

Some content is hidden

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

62 files changed

+3485
-3559
lines changed

.clang-format

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
IndentWidth: 4
2-
3-
AllowShortLambdasOnASingleLine: All
4-
AllowShortFunctionsOnASingleLine: All
5-
AlwaysBreakAfterReturnType: None
1+
BasedOnStyle: Microsoft

develop/matchit/core.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#ifndef MATCHIT_CORE_H
22
#define MATCHIT_CORE_H
33

4-
#include <tuple>
5-
#include <cstdint>
64
#include <algorithm>
5+
#include <cstdint>
6+
#include <tuple>
77

88
namespace matchit
99
{
@@ -36,10 +36,7 @@ namespace matchit
3636

3737
public:
3838
template <typename V>
39-
constexpr explicit MatchHelper(V &&value)
40-
: mValue{std::forward<V>(value)}
41-
{
42-
}
39+
constexpr explicit MatchHelper(V &&value) : mValue{std::forward<V>(value)} {}
4340
template <typename... PatternPair>
4441
constexpr auto operator()(PatternPair const &...patterns)
4542
{
@@ -56,8 +53,10 @@ namespace matchit
5653
template <typename First, typename... Values>
5754
constexpr auto match(First &&first, Values &&...values)
5855
{
59-
auto result = std::forward_as_tuple(std::forward<First>(first), std::forward<Values>(values)...);
60-
return MatchHelper<decltype(result), false>{std::forward<decltype(result)>(result)};
56+
auto result = std::forward_as_tuple(std::forward<First>(first),
57+
std::forward<Values>(values)...);
58+
return MatchHelper<decltype(result), false>{
59+
std::forward<decltype(result)>(result)};
6160
}
6261
} // namespace impl
6362

develop/matchit/expression.h

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ namespace matchit
5252
class EvalTraits<Nullary<T>>
5353
{
5454
public:
55-
constexpr static decltype(auto) evalImpl(Nullary<T> const &e)
56-
{
57-
return e();
58-
}
55+
constexpr static decltype(auto) evalImpl(Nullary<T> const &e) { return e(); }
5956
};
6057

6158
// Only allowed in nullary
@@ -65,7 +62,7 @@ namespace matchit
6562
public:
6663
constexpr static decltype(auto) evalImpl(Id<T> const &id)
6764
{
68-
return *const_cast<Id<T>&>(id);
65+
return *const_cast<Id<T> &>(id);
6966
}
7067
};
7168

@@ -130,11 +127,13 @@ namespace matchit
130127
return nullary([&] { return op eval(t); }); \
131128
}
132129

133-
#define BIN_OP_FOR_NULLARY(op) \
134-
template <typename T, typename U, std::enable_if_t<isNullaryOrIdV<T> || isNullaryOrIdV<U>, bool> = true> \
135-
constexpr auto operator op(T const &t, U const &u) \
136-
{ \
137-
return nullary([&] { return eval(t) op eval(u); }); \
130+
#define BIN_OP_FOR_NULLARY(op) \
131+
template <typename T, typename U, \
132+
std::enable_if_t<isNullaryOrIdV<T> || isNullaryOrIdV<U>, bool> = \
133+
true> \
134+
constexpr auto operator op(T const &t, U const &u) \
135+
{ \
136+
return nullary([&] { return eval(t) op eval(u); }); \
138137
}
139138

140139
// ADL will find these operators.
@@ -192,11 +191,15 @@ namespace matchit
192191
return unary([&](auto &&arg) constexpr { return op eval(t, arg); }); \
193192
}
194193

195-
#define BIN_OP_FOR_UNARY(op) \
196-
template <typename T, typename U, std::enable_if_t<isUnaryOrWildcardV<T> || isUnaryOrWildcardV<U>, bool> = true> \
197-
constexpr auto operator op(T const &t, U const &u) \
198-
{ \
199-
return unary([&](auto &&arg) constexpr { return eval(t, arg) op eval(u, arg); }); \
194+
#define BIN_OP_FOR_UNARY(op) \
195+
template <typename T, typename U, \
196+
std::enable_if_t<isUnaryOrWildcardV<T> || isUnaryOrWildcardV<U>, \
197+
bool> = true> \
198+
constexpr auto operator op(T const &t, U const &u) \
199+
{ \
200+
return unary([&](auto &&arg) constexpr { \
201+
return eval(t, arg) op eval(u, arg); \
202+
}); \
200203
}
201204

202205
UN_OP_FOR_UNARY(!)

0 commit comments

Comments
 (0)