Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::any and const pointers
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-12-02 16:43:26


On Wed, Dec 2, 2009 at 3:29 PM, James C. Sutherland <
James.Sutherland_at_[hidden]> 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?

Why can't you use boost::enable_if and only enable the get<> template if the
argument is const? This imposes the restriction that you actually invoke
the get<> template as follows:

const int m = get<const int>(p, "int");

const int* m2 = get<const int*>(p, "int*");

but it still seems to work. Is this unsatisfactory for some reason?

Zach



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net