Exemplo n.º 1
0
_TEST_EXPORT rw_any_t::~rw_any_t ()
{
    // free string allocated by tostr() (via a call to sprintfa())
    free (str_);

    memset (&val_, 0, sizeof val_);

    str_ = 0;
    tid_ = type_id_t ();
}
Exemplo n.º 2
0
namespace rill
{
    //
    auto const type_id_limit = type_id_t( std::numeric_limits<std::size_t>::max() - 20 );
    auto const type_id_special = type_id_t( std::numeric_limits<std::size_t>::max() - 19 );
    auto const type_id_special_limit = type_id_t( std::numeric_limits<std::size_t>::max() - 1 );
    auto const type_id_undefined = type_id_t( std::numeric_limits<std::size_t>::max() );

    // -18 ~ -2
    enum struct type_id_nontype : type_id_t
    {
        e_function = type_id_t( std::numeric_limits<std::size_t>::max() - 18 ),
        e_template_class = type_id_t( std::numeric_limits<std::size_t>::max() - 17 ),
        e_namespace = type_id_t( std::numeric_limits<std::size_t>::max() - 16 ),
        last = type_id_special_limit
    };

    inline auto is_nontype_id( type_id_t const& tid )
        -> bool
    {
        return tid >= type_id_special && tid < type_id_special_limit;
    }

    inline auto is_type_id( type_id_t const& tid )
        -> bool
    {
        return !is_nontype_id( tid ) && tid != type_id_undefined;
    }


    namespace detail
    {
        struct type_id_t_hasher
        {
            inline auto operator()( const type_id_t& t ) const
                -> std::size_t
            {
                return std::hash<std::size_t>()( t /*t.t*/ );
            }
        };
    } // namespace detail


    typedef std::vector<type_id_t> type_id_list_t;

    //
    class type_registry;

} // namespace rill
Exemplo n.º 3
0
constexpr inline type_id_t typeident_impl() noexcept
{
    return type_id_t(pconstvoid(&typeident_impl<T>));
}