Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
McCallisterRomer committed Dec 2, 2023
1 parent b447156 commit 1682fea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions include/ncutility/BinarySerialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace nc::serialize
* - Trivially copyable types
* - Stl types: string, array, vector, unordered_map, pair, and optional
* - Aggregates with <= 16 members, each satisfying at least one
* of these requirements
* of the above requirements
*/
inline constexpr nc::serialize::cpo::SerializeFn Serialize;

Expand All @@ -48,4 +48,4 @@ inline constexpr nc::serialize::cpo::DeserializeFn Deserialize;

/** @brief The maximum number of members an aggregate may have for default serialization. */
inline constexpr size_t g_aggregateMaxMemberCount = 16ull;
} // namespace nc::serizlize
} // namespace nc::seriazlize
32 changes: 16 additions & 16 deletions include/ncutility/detail/BinarySerializationDetail.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,31 @@ template<class T>
consteval auto MemberCount() -> size_t
{
using U = UniversalType;
if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
return g_failedMemberCount;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
return 16ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
return 15ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
return 14ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
return 13ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
return 12ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
return 11ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
return 10ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
return 9ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
return 8ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}, U{}}; })
return 7ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}, U{}}; })
return 6ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}}; })
else if constexpr (requires { T{U{}, U{}, U{}, U{}, U{}}; })
return 5ull;
else if constexpr (requires { T{U{}, U{}, U{}, U{}}; })
return 4ull;
Expand All @@ -82,9 +82,6 @@ concept UnpackableAggregate = Aggregate<T>
template<class T>
void Serialize(std::ostream& stream, const T& in);

template<class T>
void Deserialize(std::istream& stream, T& out);

template<TriviallyCopyable T>
void Serialize(std::ostream& stream, const T& in);

Expand All @@ -106,6 +103,9 @@ void Serialize(std::ostream& stream, const std::unordered_map<K, V>& in);
template<class T>
void Serialize(std::ostream& stream, const std::optional<T>& in);

template<class T>
void Deserialize(std::istream& stream, T& out);

template<TriviallyCopyable T>
void Deserialize(std::istream& stream, T& in);

Expand Down

0 comments on commit 1682fea

Please sign in to comment.