Boost logo

Boost Users :

Subject: Re: [Boost-users] Making boost::any play nice in function overloads
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-09-28 13:27:47


On 28/09/10 18:09, dakatz_at_[hidden] wrote:

> When I tried to call doSomething with a string literal argument
> (i.e. table.doSomething("Hello")), it of course failed since boost:any
> can't be initialized with an array. Okay - no problem. Another
> overload should do the trick, right?
>
> So I added an overload like this:
>
> ------------------------------------------------------------------------
> class Table
> {
> public:
> void doSomething(const boost::any& input);
>
> // Supposed to take a const char*, convert it to a string, and
> // pass off to boost::any case.
> void doSomething(const std::string& input);

How about

        template<std::size_t N>
        void doSomething(const char (&input)[N]);


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