#ifndef _TILE_BASE_INTERNAL_EARLY_INIT_H
#define _TILE_BASE_INTERNAL_EARLY_INIT_H

#pragma once
#include "tile/base/never_destroyed.h"

namespace tile {
namespace internal {
namespace detail {
template<typename T, typename Tag = void>
struct EarlyInitInstance {
    static NeverDestroyed<T> object;
};

template<typename T, typename Tag>
NeverDestroyed<T> EarlyInitInstance<T, Tag>::object;

}// namespace detail

template<typename T, typename Tag = void>
const T &
EarlyInitConstant()
{
    return *detail::EarlyInitInstance<T, Tag>::object.Get();
}

}// namespace internal
}// namespace tile

#endif// _TILE_BASE_INTERNAL_EARLY_INIT_H
