|
Boost : |
Subject: Re: [boost] [any] Multimethod for boost::any and modified boost::any to fit multi method
From: Nowake (nowake_at_[hidden])
Date: 2009-02-16 10:15:04
> I update Multimethod that use boost::unorderd_map.
> Currently, Multimethod dispatches method in constant-time.
I made a mistake.
I didn't know that std::type_info instance is not unique in a program.
I had to change boost::any::type and boost::any::holder::type like this;
__________________________________________________________
template<typename ValueType>
static const std::type_info& any::typeinfo()
{
static const std::type_info& r(typeid(ValueType));
return r;
}
const std::type_info & any::type() const
{
return content ? content->type() : typeinfo<void>();
//return content ? content->type() : typeid(void);
}
template<typename ValueType>
virtual const std::type_info&
boost::any::holder<ValueType>::type() const
{
return typeinfo<ValueType>();
//return typeid(ValueType);
}
__________________________________________________________
It's necessary to change boost::any to implement multimethod
dispatching in constant-time.
Regards.
Nowake
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk