Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sparrow::nullable implementation #135

Merged
merged 34 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5a8d37b
sparrow::optional implementation
JohanMabille Jul 3, 2024
bf7282c
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
419d08b
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
7f7476f
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
8050eb2
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
94554d3
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
8954026
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
a5751a0
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
49d609a
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
97c6451
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
e0a2856
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
6e5bf3a
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
61510c0
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
3f82a7f
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
1413158
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
ed3e873
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
87a4055
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
5851c8d
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
3a0f607
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
be08491
Update test/test_optional.cpp
JohanMabille Jul 5, 2024
a86165f
Added make_optional helper
JohanMabille Jul 5, 2024
9734b97
Added constraint on optional flag type parameter
JohanMabille Jul 5, 2024
60df3a5
optional -> nullable
JohanMabille Jul 5, 2024
d849115
Fixed renaming
JohanMabille Jul 5, 2024
ac74c31
Changes according to review
JohanMabille Jul 8, 2024
dff865e
Simplified is_nullable_v implmeentation
JohanMabille Jul 8, 2024
03e1ecf
Initialize from value / has_value overload to avoid accidental move o…
JohanMabille Jul 9, 2024
0ad6267
Minor improvements
JohanMabille Jul 9, 2024
adf85c2
Changes according to review
JohanMabille Jul 10, 2024
4f2e1cc
Added more documentation
JohanMabille Jul 12, 2024
0c64d3c
GNiiiiiiaaaaaarrrrrgh
JohanMabille Jul 12, 2024
3830cbc
Conditional noexcept
JohanMabille Jul 12, 2024
760c3ff
Please merge me! I caaaan't wait!
JohanMabille Jul 12, 2024
fcf0fe2
Do not import boolean_like concept in sparrow namespace
JohanMabille Jul 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ set(SPARROW_HEADERS
${SPARROW_INCLUDE_DIR}/sparrow/memory.hpp
${SPARROW_INCLUDE_DIR}/sparrow/mp_utils.hpp
${SPARROW_INCLUDE_DIR}/sparrow/null_layout.hpp
${SPARROW_INCLUDE_DIR}/sparrow/nullable.hpp
${SPARROW_INCLUDE_DIR}/sparrow/sparrow_version.hpp
${SPARROW_INCLUDE_DIR}/sparrow/typed_array.hpp
${SPARROW_INCLUDE_DIR}/sparrow/variable_size_binary_layout.hpp
Expand Down
14 changes: 14 additions & 0 deletions include/sparrow/mp_utils.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 Man Group Operations Limited

Check notice on line 1 in include/sparrow/mp_utils.hpp

View workflow job for this annotation

GitHub Actions / build

Run clang-format on include/sparrow/mp_utils.hpp

File include/sparrow/mp_utils.hpp does not conform to Custom style guidelines. (lines 359, 425)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -355,6 +355,15 @@
//////////////////////////////////////////////////
//// Miscellaneous ///////////////////////////////

template <class T>
struct add_const_lvalue_reference
: std::add_lvalue_reference<std::add_const_t<T>>
{
};

template <class T>
using add_const_lvalue_reference_t = typename add_const_lvalue_reference<T>::type;
Comment on lines +364 to +365
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add unit tests ?


template <class T, bool is_const>
struct constify : std::conditional<is_const, const T, T>
{
Expand Down Expand Up @@ -410,4 +419,9 @@
#endif
}

/// Matches types that can be convertible to and assignable from bool. We do not use
/// `std::convertible_to` because we don't want to impose an implicit conversion.
template <class T>
concept boolean_like = std::is_assignable_v<std::add_lvalue_reference_t<T>, bool> and
requires { static_cast<bool>(std::declval<T>()); };
}
Loading
Loading