On Mon, Jun 18, 2018 at 5:22 PM, Maarten Verhage via Boost-users
----- Original Message ----- From: "Michael Powell via Boost-users"
To: Cc: "Michael Powell" Sent: Monday, June 18, 2018 23:00 Subject: Re: [Boost-users] operator<< for std::vector< boost::variant< type_a, type_b >> On Mon, Jun 18, 2018 at 4:51 PM, Chris Cleeland via Boost-users
wrote: On Mon, Jun 18, 2018 at 3:20 PM Maarten Verhage via Boost-users
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;
I'm actually pursuing this tree-like hierarchy. I might even need to make it recursive. But I want to start easy.
typedef std::vector< boost::variant< int, double >> parameter_t; typedef std::vector< boost::variant< int, double, parameter_t >> employee_t;
Have you looked into the stackoverflow answer by: Richard Hodges? The poster had the same compiler error and the solution Richard presented is significantly more complicated than a single operator<< overload.
To be perfectly clear, I'm not sure what you're fishing for here, and I am definitely not here to analyze nor troubleshoot your code. But, there did seem to be at least a general question about operator overloading. What you do with that knowledge in your specific case is entirely up to you. I'm not at liberty to discuss beyond that.
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@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users