File: has_flatten_fields.hpp

package info (click to toggle)
reflect-cpp 0.18.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 12,524 kB
  • sloc: cpp: 44,484; python: 131; makefile: 30; sh: 3
file content (32 lines) | stat: -rw-r--r-- 791 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef RFL_INTERNAL_HASFLATTENFIELDS_HPP_
#define RFL_INTERNAL_HASFLATTENFIELDS_HPP_

#include <tuple>
#include <type_traits>
#include <utility>

#include "../Tuple.hpp"
#include "is_flatten_field.hpp"

namespace rfl {
namespace internal {

template <class TupleType>
constexpr bool has_flatten_fields() {
  const auto is_true_for_one =
      []<int _i>(std::integral_constant<int, _i>) -> bool {
    using T = std::remove_cvref_t<tuple_element_t<_i, TupleType>>;
    return is_flatten_field_v<T>;
  };

  return [&]<int... _is>(std::integer_sequence<int, _is...>) {
    return (false || ... ||
            is_true_for_one(std::integral_constant<int, _is>{}));
  }
  (std::make_integer_sequence<int, rfl::tuple_size_v<TupleType>>());
}

}  // namespace internal
}  // namespace rfl

#endif