|
12 | 12 | #include "alife_space.h" |
13 | 13 | #include "Common/object_type_traits.h" |
14 | 14 |
|
15 | | -template <typename, typename> |
| 15 | +template <typename TContainer, typename TList> |
16 | 16 | struct RegistryHelper; |
17 | 17 |
|
18 | 18 | template <typename TContainer> |
19 | | -struct RegistryHelper<TContainer, Loki::Typelist<>> |
| 19 | +struct RegistryHelper<TContainer, Loki::NullType> |
20 | 20 | { |
21 | 21 | static void Save(TContainer*, IWriter&) {}; |
22 | 22 | static void Load(TContainer*, IReader&) {}; |
23 | 23 | }; |
24 | 24 |
|
25 | | -template <typename TContainer, typename T, typename... Ts> |
26 | | -struct RegistryHelper<TContainer, Loki::Typelist<T, Ts...>> |
| 25 | +template <typename TContainer, typename Head, typename Tail> |
| 26 | +struct RegistryHelper<TContainer, Loki::Typelist<Head, Tail>> |
27 | 27 | { |
28 | | - static constexpr bool isSerializable = object_type_traits::is_base_and_derived<ISerializable, T>::value; |
| 28 | + static constexpr bool isSerializable = |
| 29 | + object_type_traits::is_base_and_derived<ISerializable, Head>::value; |
29 | 30 |
|
30 | 31 | static void Save(TContainer* self, IWriter& writer) |
31 | 32 | { |
32 | 33 | if constexpr (isSerializable) |
33 | | - self->T::save(writer); |
34 | | - RegistryHelper<TContainer, Loki::Typelist<Ts...>>::Save(self, writer); |
| 34 | + self->Head::save(writer); |
| 35 | + RegistryHelper<TContainer, Tail>::Save(self, writer); |
35 | 36 | }; |
36 | 37 |
|
37 | 38 | static void Load(TContainer* self, IReader& reader) |
38 | 39 | { |
39 | 40 | if constexpr (isSerializable) |
40 | | - self->T::load(reader); |
41 | | - RegistryHelper<TContainer, Loki::Typelist<Ts...>>::Load(self, reader); |
| 41 | + self->Head::load(reader); |
| 42 | + RegistryHelper<TContainer, Tail>::Load(self, reader); |
42 | 43 | } |
43 | | - |
44 | 44 | }; |
45 | 45 |
|
46 | 46 | void CALifeRegistryContainer::load(IReader& file_stream) |
|
0 commit comments