Skip to content

Commit 2ad85f0

Browse files
committed
Revert "auto_base: flatten the list of base classes"
This reverts commit f96f531.
1 parent 98fad61 commit 2ad85f0

File tree

2 files changed

+1
-49
lines changed

2 files changed

+1
-49
lines changed

include/adm/detail/auto_base.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace adm {
3232
/// make a class derived from the given base classes, combining the
3333
/// get, set, has, isDefault and unset overloads
3434
template <typename... Bases>
35-
using HasParameters = HasParametersImpl<TypeList<Bases...>>;
35+
using HasParameters = Combine<TypeList<Bases...>>;
3636

3737
/// Get the default value of T parameters. Specialise this to add custom
3838
/// defaults.

include/adm/detail/auto_base_detail.hpp

-48
Original file line numberDiff line numberDiff line change
@@ -101,53 +101,5 @@ namespace adm {
101101
using AddRemoveBases::add...;
102102
using AddRemoveBases::remove...;
103103
};
104-
105-
/// flatten a TypeList of classes; any Combine<TypeList<B...>, ...> in
106-
/// FlattenBases is replaced by B...
107-
///
108-
/// This is used to deal with VariantParameter, which is implemented with
109-
/// HasParameters (and therefore Combine). This works, but makes for
110-
/// excessively long type names, and more classes than necessary
111-
template <typename Bases>
112-
struct FlattenBases;
113-
114-
// turn Combine at the head into its TypeList of bases
115-
template <typename HeadBases, typename... HeadArgs, typename... Tail>
116-
struct FlattenBases<TypeList<Combine<HeadBases, HeadArgs...>, Tail...>> {
117-
using type =
118-
typename FlattenBases<Cons<HeadBases, TypeList<Tail...>>>::type;
119-
};
120-
121-
// handle the head of a TypeList at the head
122-
template <typename HeadHead, typename... HeadTail, typename... Tail>
123-
struct FlattenBases<TypeList<TypeList<HeadHead, HeadTail...>, Tail...>> {
124-
using type =
125-
Cons<HeadHead, typename FlattenBases<Cons<TypeList<HeadTail...>,
126-
TypeList<Tail...>>>::type>;
127-
};
128-
129-
// handle an empty TypeList at the head
130-
template <typename... Tail>
131-
struct FlattenBases<TypeList<TypeList<>, Tail...>> {
132-
using type = typename FlattenBases<TypeList<Tail...>>::type;
133-
};
134-
135-
// handle a regular base at the head
136-
template <typename Head, typename... Tail>
137-
struct FlattenBases<TypeList<Head, Tail...>> {
138-
using type = Cons<Head, typename FlattenBases<TypeList<Tail...>>::type>;
139-
};
140-
141-
// handle an empty list
142-
template <>
143-
struct FlattenBases<TypeList<>> {
144-
using type = TypeList<>;
145-
};
146-
147-
/// implementation for HasParameters, accepting a TypeList of bases and
148-
/// yielding a Combine with the appropriate classes in each list, selected
149-
/// by flags
150-
template <typename BasesList>
151-
using HasParametersImpl = Combine<typename FlattenBases<BasesList>::type>;
152104
} // namespace detail
153105
} // namespace adm

0 commit comments

Comments
 (0)