Boost Users :
Subject: Re: [Boost-users] generic vector
From: Joren Heit (jorenheit_at_[hidden])
Date: 2015-02-17 04:13:48
C++11 offers non-restricted unions, which you can wrap in a class:
int64_t x1; // use better names than these...
explicit Wrapper(int64_t x1)
m_u.x1 = x1;
// You'll also need some clever getters
On Feb 17, 2015 6:00 AM, "Ben Pope" <benpope81_at_[hidden]> wrote:
> On Tuesday, February 17, 2015 12:34 PM, U.Mutlu wrote:
>> I need to have a std::vector in my program, but it's type
>> will be known only when it runs, ie. the type will be provided
>> via a program param. The possible types are limited to these: int64_t,
>> uint64_t, double, std::string.
>> Is there a solution in boost or C++11 for this kind of problem?
> std::vector<boost::variant<int64_t, uint64_t, double, std::string>>
> Boost-users mailing list
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