$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] boost::any and const pointers
From: James C. Sutherland (James.Sutherland_at_[hidden])
Date: 2009-12-02 17:17:13
On Dec 2, 2009, at 3:03 PM, Steven Watanabe wrote:
> AMDG
> 
> James C. Sutherland wrote:
>> Thank you!
>> That works great for pointers, but now not for POD, e.g.,
>> 	const int m = get<int>(p,"int");
>> Any ideas of how to get this to work with POD and pointers?
>>  
> 
> typename boost::mpl::eval_if<is_pointer<T>,
>   boost::add_pointer<
>       typename boost::add_const<
>           typename boost::remove_pointer<T>::type
>       >::type
>   >,
>   boost::add_const<T>
> >::type
> 
> In Christ,
> Steven Watanabe
> 
You can work magic!  I suppose that I need to dig into MPL and the type_traits libraries in boost.
template< typename T >
typename boost::mpl::eval_if< boost::is_pointer<T>,
                              boost::add_pointer<
                                typename boost::add_const<
                                  typename boost::remove_pointer<T>::type
                                  >::type
                                >,
                              boost::add_const<T>
                              >::type
get( const Properties& p, const std::string name )
{ ... }
that did the job.