Skip to content

Commit 11b143e

Browse files
committed
Format
1 parent ab0785b commit 11b143e

Some content is hidden

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

55 files changed

+683
-737
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int main()
6565
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6666
6767
### Record
68-
[See it live on Compiler Explorer](https://godbolt.org/z/rqq8a6ej3)
68+
[See it live on Compiler Explorer](https://godbolt.org/z/sfb3djrPM)
6969
7070
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ c++
7171
#include <iostream>
@@ -74,19 +74,19 @@ int main()
7474
using namespace kumi::literals;
7575
auto get_student(int id)
7676
{
77-
if (id == 0) return kumi::make_record("GPA"_f = 3.8, "grade"_f = 'A');
78-
else if (id == 1) return kumi::make_record("GPA"_f = 2.9, "grade"_f = 'C');
79-
else if (id == 2) return kumi::make_record("GPA"_f = 1.7, "grade"_f = 'D');
80-
else return kumi::make_record("GPA"_f = 0. , "grade"_f = 'F');
77+
if (id == 0) return kumi::make_record("GPA"_id = 3.8, "grade"_id = 'A');
78+
else if (id == 1) return kumi::make_record("GPA"_id = 2.9, "grade"_id = 'C');
79+
else if (id == 2) return kumi::make_record("GPA"_id = 1.7, "grade"_id = 'D');
80+
else return kumi::make_record("GPA"_id = 0. , "grade"_id = 'F');
8181
}
8282
8383
int main()
8484
{
8585
auto student0 = get_student(0);
8686
8787
std::cout << "ID: 0, "
88-
<< "GPA: " << kumi::get<"GPA"_f>(student0) << ", "
89-
<< "grade: " << kumi::get<"grade"_f>(student0) << '\n';
88+
<< "GPA: " << kumi::get<"GPA">(student0) << ", "
89+
<< "grade: " << kumi::get<"grade">(student0) << '\n';
9090
9191
auto [ gpa1, grade1 ] = get_student(1);
9292
std::cout << "ID: 1, "
@@ -95,9 +95,9 @@ int main()
9595
std::cout << "\n";
9696
9797
auto all_students = kumi::make_record(
98-
"Lisa Simpson"_f = get_student(0),
99-
"Milhouse Van Houten"_f = get_student(1),
100-
"Ralph Wiggum"_f = get_student(2)
98+
"Lisa Simpson"_id = get_student(0),
99+
"Milhouse Van Houten"_id = get_student(1),
100+
"Ralph Wiggum"_id = get_student(2)
101101
);
102102
103103
kumi::for_each_field( [](auto name, auto const& m) { std::cout << "Student: " << name << ", Data : " << m << "\n";}

doc/index.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@
6666
//! using namespace kumi::literals;
6767
//! auto get_student(int id)
6868
//! {
69-
//! if (id == 0) return kumi::make_record("GPA"_f = 3.8, "grade"_f = 'A');
70-
//! else if (id == 1) return kumi::make_record("GPA"_f = 2.9, "grade"_f = 'C');
71-
//! else if (id == 2) return kumi::make_record("GPA"_f = 1.7, "grade"_f = 'D');
72-
//! else return kumi::make_record("GPA"_f = 0. , "grade"_f = 'F');
69+
//! if (id == 0) return kumi::make_record("GPA"_id = 3.8, "grade"_id = 'A');
70+
//! else if (id == 1) return kumi::make_record("GPA"_id = 2.9, "grade"_id = 'C');
71+
//! else if (id == 2) return kumi::make_record("GPA"_id = 1.7, "grade"_id = 'D');
72+
//! else return kumi::make_record("GPA"_id = 0. , "grade"_id = 'F');
7373
//! }
7474
//!
7575
//! int main()
7676
//! {
7777
//! auto student0 = get_student(0);
7878
//!
7979
//! std::cout << "ID: 0, "
80-
//! << "GPA: " << kumi::get<"GPA"_f>(student0) << ", "
81-
//! << "grade: " << kumi::get<"grade"_f>(student0) << '\n';
80+
//! << "GPA: " << kumi::get<"GPA">(student0) << ", "
81+
//! << "grade: " << kumi::get<"grade">(student0) << '\n';
8282
//!
8383
//! auto [ gpa1, grade1 ] = get_student(1);
8484
//! std::cout << "ID: 1, "
@@ -87,9 +87,9 @@
8787
//! std::cout << "\n";
8888
//!
8989
//! auto all_students = kumi::make_record(
90-
//! "Lisa Simpson"_f = get_student(0),
91-
//! "Milhouse Van Houten"_f = get_student(1),
92-
//! "Ralph Wiggum"_f = get_student(2)
90+
//! "Lisa Simpson"_id = get_student(0),
91+
//! "Milhouse Van Houten"_id = get_student(1),
92+
//! "Ralph Wiggum"_id = get_student(2)
9393
//! );
9494
//!
9595
//! kumi::for_each_field( [](auto name, auto const& m) {

doc/layout.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
</tab>
1111
<tab type="usergroup" visible="yes" title="Reference Documentation">
1212
<tab type="usergroup" visible="yes" title="Types">
13-
<tab type="user" url="@ref tuple" title="Tuple"/>
14-
<tab type="user" url="@ref record" title="Record"/>
13+
<tab type="user" url="@ref product_types" title="Product types"/>
14+
<tab type="user" url="@ref record_types" title="Record Types"/>
1515
</tab>
1616
<tab type="usergroup" visible="yes" title="Algorithms">
1717
<tab type="user" url="@ref transforms" title="Transformations"/>

include/kumi/algorithm/apply.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
//==================================================================================================
1+
//======================================================================================================================
22
/*
33
KUMI - Compact Tuple Tools
44
Copyright : KUMI Project Contributors
55
SPDX-License-Identifier: BSL-1.0
66
*/
7-
//==================================================================================================
7+
//======================================================================================================================
88
#pragma once
99

1010
namespace kumi
1111
{
12-
//================================================================================================
12+
//====================================================================================================================
1313
//! @ingroup transforms
14-
//! @brief Invoke the Callable object f with a product_type of arguments. f is applied on the
15-
//! values if the given product_type is a kumi::record
14+
//! @brief Invoke the Callable object f with the elements of product type unrolled as arguments.
15+
//!
16+
//! @note f is applied on the underlying values when the input `t` is a record type
1617
//!
1718
//! @param f Callable object to be invoked
18-
//! @param t kumi::product_type whose elements to be used as arguments to f
19-
//! @return The value returned by f.
19+
//! @param t Product Type whose elements are used as arguments to f
20+
//! @return The value returned by f.
2021
//!
2122
//! ## Helper type
2223
//! @code
@@ -34,7 +35,7 @@ namespace kumi
3435
//! ## Example
3536
//! @include doc/tuple/algo/apply.cpp
3637
//! @include doc/record/algo/apply.cpp
37-
//================================================================================================
38+
//====================================================================================================================
3839
template<typename Function, concepts::product_type T>
3940
KUMI_ABI constexpr decltype(auto) apply(Function&& f, T&& t) noexcept(_::supports_nothrow_apply<Function&&, T&&>)
4041
requires _::supports_apply<Function, T>

include/kumi/algorithm/back-front.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
//==================================================================================================
1+
//======================================================================================================================
22
/*
33
KUMI - Compact Tuple Tools
44
Copyright : KUMI Project Contributors
55
SPDX-License-Identifier: BSL-1.0
66
*/
7-
//==================================================================================================
7+
//======================================================================================================================
88
#pragma once
99

1010
namespace kumi
1111
{
12-
//================================================================================================
13-
//! @ingroup queries
12+
//====================================================================================================================
13+
//! @ingroup queries
1414
//! @brief Retrieves the front of a product type
1515
//!
16-
//! @param t Base product type
17-
//! @return A reference to the first element of the product type `t`
16+
//! @param t Base product type
17+
//! @return A reference to the first element of the product type `t`
1818
//!
1919
//! ## Helper type
2020
//! @code
@@ -32,7 +32,7 @@ namespace kumi
3232
//! ## Examples
3333
//! @include doc/tuple/algo/back-front.cpp
3434
//! @include doc/record/algo/back-front.cpp
35-
//================================================================================================
35+
//====================================================================================================================
3636
template<concepts::product_type T>
3737
[[nodiscard]] KUMI_ABI constexpr decltype(auto) front(T&& t)
3838
requires(size_v<T> != 0)
@@ -41,12 +41,12 @@ namespace kumi
4141
else return get<0>(KUMI_FWD(t));
4242
}
4343

44-
//================================================================================================
45-
//! @ingroup queries
44+
//====================================================================================================================
45+
//! @ingroup queries
4646
//! @brief Retrieves the back of a product type
4747
//!
48-
//! @param t Base product type
49-
//! @return A reference to the last element of the product type `t`
48+
//! @param t Base product type
49+
//! @return A reference to the last element of the product type `t`
5050
//!
5151
//! ## Helper type
5252
//! @code
@@ -64,7 +64,7 @@ namespace kumi
6464
//! ## Examples
6565
//! @include doc/tuple/algo/back-front.cpp
6666
//! @include doc/record/algo/back-front.cpp
67-
//================================================================================================
67+
//====================================================================================================================
6868
template<concepts::product_type T>
6969
[[nodiscard]] KUMI_ABI constexpr decltype(auto) back(T&& t)
7070
requires(size_v<T> != 0)

include/kumi/algorithm/cartesian_product.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
//==================================================================================================
1+
//======================================================================================================================
22
/*
33
KUMI - Compact Tuple Tools
44
Copyright : KUMI Project Contributors
55
SPDX-License-Identifier: BSL-1.0
66
*/
7-
//==================================================================================================
7+
//======================================================================================================================
88
#pragma once
99

1010
namespace kumi
1111
{
1212

13-
//================================================================================================
13+
//====================================================================================================================
1414
namespace _
1515
{
1616
template<std::size_t N, std::size_t... S> struct digits
@@ -36,7 +36,7 @@ namespace kumi
3636
};
3737
}
3838

39-
//================================================================================================
39+
//====================================================================================================================
4040
//! @ingroup generators
4141
//! @brief Return the Cartesian Product of all elements of its arguments product types
4242
//! @param ts Product types to process
@@ -59,7 +59,7 @@ namespace kumi
5959
//! ## Examples:
6060
//! @include doc/tuple/algo/cartesian_product.cpp
6161
//! @include doc/record/algo/cartesian_product.cpp
62-
//================================================================================================
62+
//====================================================================================================================
6363
template<concepts::product_type... Ts>
6464
[[nodiscard]] KUMI_ABI constexpr auto cartesian_product(Ts&&... ts)
6565
requires(concepts::follows_same_semantic<Ts...>)
@@ -97,7 +97,7 @@ namespace kumi
9797
{
9898
template<typename... Ts> struct cartesian_product
9999
{
100-
using type = decltype( kumi::cartesian_product( std::declval<Ts>()... ) );
100+
using type = decltype(kumi::cartesian_product(std::declval<Ts>()...));
101101
};
102102

103103
template<typename... Ts> using cartesian_product_t = typename cartesian_product<Ts...>::type;

include/kumi/algorithm/cast.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
//==================================================================================================
1+
//======================================================================================================================
22
/*
33
KUMI - Compact Tuple Tools
44
Copyright : KUMI Project Contributors
55
SPDX-License-Identifier: BSL-1.0
66
*/
7-
//==================================================================================================
7+
//======================================================================================================================
88
#pragma once
99

1010
namespace kumi
@@ -29,13 +29,13 @@ namespace kumi
2929
template<typename T, auto N> using as_homogeneous_t = typename as_homogeneous<T, N>::type;
3030
}
3131

32-
//================================================================================================
33-
//! @ingroup utility
32+
//====================================================================================================================
33+
//! @ingroup algorithms
3434
//! @brief Converts a product_type<Ts...> to an instance of a product_type<Target...>
3535
//!
36-
//! @tparam Target destination type to associate to each member of the product type
36+
//! @tparam Target destination type to associate to each member of the product type `t`
3737
//! @param t Product type to convert
38-
//! @return A Product type containing the values of b where each member is of type Target
38+
//! @return A Product type containing the values of t where each member is of type Target
3939
//!
4040
//! ## Helper type
4141
//! @code
@@ -53,7 +53,7 @@ namespace kumi
5353
//! ## Examples:
5454
//! @include doc/tuple/algo/member_cast.cpp
5555
//! @include doc/record/algo/member_cast.cpp
56-
//================================================================================================
56+
//====================================================================================================================
5757
template<typename Target, concepts::product_type T> [[nodiscard]] KUMI_ABI constexpr auto member_cast(T&& t)
5858
{
5959
if constexpr (concepts::sized_product_type<T, 0>) return t;

include/kumi/algorithm/cat.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
//==================================================================================================
1+
//======================================================================================================================
22
/*
33
KUMI - Compact Tuple Tools
44
Copyright : KUMI Project Contributors
55
SPDX-License-Identifier: BSL-1.0
66
*/
7-
//==================================================================================================
7+
//======================================================================================================================
88
#pragma once
99

1010
namespace kumi
1111
{
12-
//================================================================================================
12+
//====================================================================================================================
1313
//! @ingroup generators
1414
//! @brief Concatenates product types in a single one
1515
//!
@@ -32,7 +32,7 @@ namespace kumi
3232
//! ## Examples:
3333
//! @include doc/tuple/algo/cat.cpp
3434
//! @include doc/record/algo/cat.cpp
35-
//================================================================================================
35+
//====================================================================================================================
3636
template<concepts::product_type... Ts>
3737
[[nodiscard]] KUMI_ABI constexpr auto cat(Ts&&... ts)
3838
requires(concepts::follows_same_semantic<Ts...>)

0 commit comments

Comments
 (0)