Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Sep 23, 2024
1 parent 5bd83d3 commit 8e684e4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions include/ylt/standalone/iguana/dynamic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ constexpr inline uint8_t ENABLE_ALL = 0x0F;

template <typename T, uint8_t ENABLE_FLAG = ENABLE_PB>
struct base_impl : public base {
base_impl() {
// make sure init T before main, and can register_type before main.
[[maybe_unused]] static auto t =
ylt::reflection::internal::wrapper<T>::value;
[[maybe_unused]] static bool r = register_type<T>();
}
base_impl() { [[maybe_unused]] static bool r = register_type<T>(); }
void to_pb(std::string& str) const override {
if constexpr ((ENABLE_FLAG & ENABLE_PB) != 0) {
to_pb_adl((iguana_adl_t*)nullptr, *(static_cast<T const*>(this)), str);
Expand Down Expand Up @@ -164,6 +159,13 @@ struct base_impl : public base {
virtual ~base_impl() {}

mutable size_t cache_size = 0;

private:
virtual void dummy() {
// make sure init T before main, and can register_type before main.
[[maybe_unused]] static auto t =
ylt::reflection::internal::wrapper<T>::value;
}
};

IGUANA_INLINE std::shared_ptr<base> create_instance(std::string_view name) {
Expand Down

0 comments on commit 8e684e4

Please sign in to comment.