Boost logo

Boost Users :

Subject: Re: [Boost-users] operator<< for std::vector< boost::variant< type_a, type_b >>
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2018-06-18 21:00:54


On Mon, Jun 18, 2018 at 4:51 PM, Chris Cleeland via Boost-users
<boost-users_at_[hidden]> wrote:
>
>
> On Mon, Jun 18, 2018 at 3:20 PM Maarten Verhage via Boost-users
> <boost-users_at_[hidden]> wrote:
>>
>>
>>
>> boost::variant is obviously part of boost. And the compiler error is
>> pointing in a variant header. So I'm pretty confident "Boost users" in the
>> appropriate mailing list for this issue.
>
>
> Except for the fact that it's not. I looked at the code, and I suspect
> you've ended up confusing yourself.
>
> In particular, your typedefs are confusing. Are you sure you didn't mean
> this? It looks like you did based on the rest of the code.
>
> typedef boost::variant< int, double > parameter_t;
> typedef std::vector< parameter_t > employee_t;
>
> In other words, a vector (type `employee_t`) where each element is a variant
> of either `int` or `double`.
>
> If that's what you meant to type, then compiling with clang++ -std=c++14
> creates an a.out that prints "306000" as expected.
>
>>
>>
>> You know, I sense some resentment against me. Can you clarify please?
>
>
> I didn't. In fact, he answered your question by giving you references to
> documentation based on the error message you presented. Unfortunately I
> think that error message was a red herring.

Glad to help. Consider it on the table, rule it out if it isn't useful
to you, or in this case helps to narrow the root cause, or whatever.
Completely up to you.

>> If you opened the attachment you can see I'm already at that level. And
>> according to the stackoverflow answer for a very much related issue the
>> solution is some next level stuff.
>
>
> Fortunately, I suspect that the solution really just involves fixing your
> types.
>
> --
> Chris Cleeland
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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