Skip to content
This repository was archived by the owner on Sep 9, 2021. It is now read-only.

Commit d8d315a

Browse files
committed
Update indent
1 parent 77887c7 commit d8d315a

File tree

11 files changed

+66
-35
lines changed

11 files changed

+66
-35
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ void draw_text(Args &&...args) { // def draw_text(x: int, y: in
3131
parameter<int>(keywords::y),
3232
parameter(keywords::msg),
3333
keyword_parameter<int>(keywords::width) = 4,
34-
std::forward<Args>(args)...);
34+
std::forward<Args>(args)...
35+
);
3536
std::cout << "(" << std::setw(width) << x << "," << std::setw(width) << y << ") : " << msg << std::endl;
3637
}
3738

@@ -83,7 +84,8 @@ void greet_v1(Args &&...args) { // def greet_v1(name, out = st
8384
auto [name, out] = match(
8485
parameter(keywords::name), // Declare a parameter.
8586
parameter(keywords::out) = std::cout, // A parameter can have a default value.
86-
std::forward<Args>(args)...);
87+
std::forward<Args>(args)...
88+
);
8789
out << "Hello, " << name << "!\n";
8890
}
8991
@@ -114,7 +116,8 @@ void greet_v2(Args &&...args) { // def greet_v2(name: std.stri
114116
keyword_parameter<std::ostream &>(keywords::out) = std::cout,
115117
// Declare a keyword-only parameter.
116118
// It can be specified only by a keyword.
117-
std::forward<Args>(args)...);
119+
std::forward<Args>(args)...
120+
);
118121
out << "Hello, " << name << "!\n";
119122
}
120123

@@ -147,7 +150,8 @@ void f(Args &&...args) { // def f(x, y):
147150
auto [x, y] = match(
148151
parameter(keywords::x),
149152
parameter(keywords::y),
150-
std::forward<Args>(args)...);
153+
std::forward<Args>(args)...
154+
);
151155
std::cout << "x = " << x << "\n";
152156
std::cout << "y = " << y << "\n";
153157
}
@@ -163,7 +167,7 @@ GCC 8.2.0 and Clang 7.0.0 show the following error messages.
163167
```
164168
$ g++ -std=c++17 compile_error.cpp
165169
compile_error.cpp: In instantiation of 'void f(Args&& ...) [with Args = {int, int, flexargs::detail::keyword_argument<keywords::x_, int>}]':
166-
compile_error.cpp:31:18: required from here
170+
compile_error.cpp:32:18: required from here
167171
compile_error.cpp:21:10: error: cannot decompose class type 'flexargs::detail::syntax_error<flexargs::detail::duplicate_argument<keywords::x_> >' without non-static data members
168172
auto [x, y] = match(
169173
^~~~~~
@@ -172,7 +176,7 @@ $ clang++ -std=c++17 compile_error.cpp
172176
compile_error.cpp:21:10: error: type 'flexargs::detail::syntax_error<flexargs::detail::duplicate_argument<keywords::x_> >' decomposes into 0 elements, but 2 names were provided
173177
auto [x, y] = match(
174178
^
175-
compile_error.cpp:31:5: note: in instantiation of function template specialization 'f<int, int, flexargs::detail::keyword_argument<keywords::x_, int> >' requested here
179+
compile_error.cpp:32:5: note: in instantiation of function template specialization 'f<int, int, flexargs::detail::keyword_argument<keywords::x_, int> >' requested here
176180
f(1, 2, x = 3);
177181
^
178182
1 error generated.
@@ -226,7 +230,8 @@ int calc_v1(Args &&...args) {
226230
parameter<std::string_view>(keywords::op),
227231
parameter<int>(keywords::lhs) = 100,
228232
parameter<int>(keywords::rhs) = 200,
229-
std::forward<Args>(args)...);
233+
std::forward<Args>(args)...
234+
);
230235
if (op == "add") {
231236
return lhs + rhs;
232237
} else if (op == "sub") {

example/compile_error.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ void f(Args &&...args) { // def f(x, y):
2121
auto [x, y] = match(
2222
parameter(keywords::x),
2323
parameter(keywords::y),
24-
std::forward<Args>(args)...);
24+
std::forward<Args>(args)...
25+
);
2526
std::cout << "x = " << x << "\n";
2627
std::cout << "y = " << y << "\n";
2728
}
@@ -34,7 +35,7 @@ int main() {
3435
/*
3536
$ g++ -std=c++17 compile_error.cpp
3637
compile_error.cpp: In instantiation of 'void f(Args&& ...) [with Args = {int, int, flexargs::detail::keyword_argument<keywords::x_, int>}]':
37-
compile_error.cpp:31:18: required from here
38+
compile_error.cpp:32:18: required from here
3839
compile_error.cpp:21:10: error: cannot decompose class type 'flexargs::detail::syntax_error<flexargs::detail::duplicate_argument<keywords::x_> >' without non-static data members
3940
auto [x, y] = match(
4041
^~~~~~
@@ -43,7 +44,7 @@ compile_error.cpp:21:10: error: cannot decompose class type 'flexargs::detail::s
4344
compile_error.cpp:21:10: error: type 'flexargs::detail::syntax_error<flexargs::detail::duplicate_argument<keywords::x_> >' decomposes into 0 elements, but 2 names were provided
4445
auto [x, y] = match(
4546
^
46-
compile_error.cpp:31:5: note: in instantiation of function template specialization 'f<int, int, flexargs::detail::keyword_argument<keywords::x_, int> >' requested here
47+
compile_error.cpp:32:5: note: in instantiation of function template specialization 'f<int, int, flexargs::detail::keyword_argument<keywords::x_, int> >' requested here
4748
f(1, 2, x = 3);
4849
^
4950
1 error generated.

example/constexpr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ constexpr auto add(Args &&...args) {
2020
auto [lhs, rhs] = match(
2121
parameter(keywords::lhs),
2222
parameter(keywords::rhs),
23-
std::forward<Args>(args)...);
23+
std::forward<Args>(args)...
24+
);
2425
return lhs + rhs;
2526
}
2627

example/draw_text.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ void draw_text(Args &&...args) { // def draw_text(x: int, y: in
3030
parameter<int>(keywords::y),
3131
parameter(keywords::msg),
3232
keyword_parameter<int>(keywords::width) = 4,
33-
std::forward<Args>(args)...);
33+
std::forward<Args>(args)...
34+
);
3435
std::cout << "(" << std::setw(width) << x << "," << std::setw(width) << y << ") : " << msg << std::endl;
3536
}
3637

example/greet_v1.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ void greet_v1(Args &&...args) { // def greet_v1(name, out = st
2121
auto [name, out] = match(
2222
parameter(keywords::name), // Declare a parameter.
2323
parameter(keywords::out) = std::cout, // A parameter can have a default value.
24-
std::forward<Args>(args)...);
24+
std::forward<Args>(args)...
25+
);
2526
out << "Hello, " << name << "!\n";
2627
}
2728

example/greet_v2.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ void greet_v2(Args &&...args) { // def greet_v2(name: std.stri
2525
keyword_parameter<std::ostream &>(keywords::out) = std::cout,
2626
// Declare a keyword-only parameter.
2727
// It can be specified only by a keyword.
28-
std::forward<Args>(args)...);
28+
std::forward<Args>(args)...
29+
);
2930
out << "Hello, " << name << "!\n";
3031
}
3132

example/performance.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ int calc_v1(Args &&...args) {
4646
parameter<std::string_view>(keywords::op),
4747
parameter<int>(keywords::lhs) = 100,
4848
parameter<int>(keywords::rhs) = 200,
49-
std::forward<Args>(args)...);
49+
std::forward<Args>(args)...
50+
);
5051
if (op == "add") {
5152
return lhs + rhs;
5253
} else if (op == "sub") {

flexargs.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ constexpr decltype(auto) construct_params_ii([[maybe_unused]] Param &&param, [[m
546546
template <class Params, class Args, class ParamCtors, std::size_t ...ParamIndices>
547547
constexpr auto construct_params_i(Params &&params, Args &&args, ParamCtors param_ctors, std::index_sequence<ParamIndices...>) {
548548
return std::tuple<decltype(construct_params_ii(std::get<ParamIndices>(std::move(params)), std::move(args), std::get<ParamIndices>(param_ctors)))...>(
549-
construct_params_ii(std::get<ParamIndices>(std::move(params)), std::move(args), std::get<ParamIndices>(param_ctors))...);
549+
construct_params_ii(std::get<ParamIndices>(std::move(params)), std::move(args), std::get<ParamIndices>(param_ctors))...
550+
);
550551
}
551552

552553
template <class Params, class Args, class ParamCtors>

test/success.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ void f(Args &&...args) {
1919
parameter<int>(keywords::y) = 2,
2020
keyword_parameter<std::is_integral>(keywords::z),
2121
keyword_parameter(keywords::w) = 4,
22-
std::forward<Args>(args)...);
22+
std::forward<Args>(args)...
23+
);
2324
BOOST_TEST_EQ(x, 1);
2425
BOOST_TEST_EQ(y, 2);
2526
BOOST_TEST_EQ(z, 3);

test/syntax_error.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,51 +13,59 @@ int main() {
1313
{
1414
auto e = match(
1515
parameter(keywords::x) = 1,
16-
parameter<int>(keywords::y));
16+
parameter<int>(keywords::y)
17+
);
1718
static_assert(is_instance_of<detail::syntax_error<detail::non_default_parameter_after_default_parameter<keywords::y_>>>(e));
1819
}
1920
{
2021
auto e = match(
2122
keyword_parameter(keywords::x),
22-
parameter(keywords::y));
23+
parameter(keywords::y)
24+
);
2325
static_assert(is_instance_of<detail::syntax_error<detail::non_keyword_parameter_after_keyword_parameter<keywords::y_>>>(e));
2426
}
2527
{
2628
auto e = match(
2729
parameter<std::is_integral>(keywords::x) = 3,
28-
keyword_parameter<int>(keywords::x));
30+
keyword_parameter<int>(keywords::x)
31+
);
2932
static_assert(is_instance_of<detail::syntax_error<detail::duplicate_parameter<keywords::x_>>>(e));
3033
}
3134
{
3235
auto e = match(
3336
keyword_parameter<std::is_integral>(keywords::x),
3437
keyword_parameter(keywords::y) = 4,
3538
keywords::x = 5,
36-
6);
39+
6
40+
);
3741
static_assert(is_instance_of<detail::syntax_error<detail::non_keyword_argument_after_keyword_argument>>(e));
3842
}
3943
{
4044
auto e = match(
4145
keyword_parameter<int>(keywords::x) = 7,
4246
keywords::x = 8,
43-
keywords::x = 9);
47+
keywords::x = 9
48+
);
4449
static_assert(is_instance_of<detail::syntax_error<detail::duplicate_argument<keywords::x_>>>(e));
4550
}
4651
{
4752
auto e = match(
4853
parameter<int>(keywords::x) = 7,
4954
8,
50-
keywords::x = 9);
55+
keywords::x = 9
56+
);
5157
static_assert(is_instance_of<detail::syntax_error<detail::duplicate_argument<keywords::x_>>>(e));
5258
}
5359
{
5460
auto e = match(
55-
parameter(keywords::x));
61+
parameter(keywords::x)
62+
);
5663
static_assert(is_instance_of<detail::syntax_error<detail::missing_argument<keywords::x_>>>(e));
5764
}
5865
{
5966
auto e = match(
60-
15);
67+
15
68+
);
6169
static_assert(is_instance_of<detail::syntax_error<detail::extra_non_keyword_argument>>(e));
6270
}
6371
}

0 commit comments

Comments
 (0)