Boost logo

Boost :

Subject: Re: [boost] [review][variant2] visit needs better user documentation
From: Larry Evans (cppljevans_at_[hidden])
Date: 2019-04-06 15:01:52

On 4/6/19 8:44 AM, Peter Dimov via Boost wrote:
> Larry Evans wrote:
>> The documents here:
>> suggest visit can take any number of arguments.  However, the attached
>> fails to compile when defined(ARGS5).  The user docs should make clear
>> that there is a limit to the number of arguments.
> The error has nothing to do with number of arguments. The function
> object needs to be callable with any combination of types; the first
> variant, for instance, may hold a string, and therefore, the function
> object must be able to accept a string as its first argument.

I only drew that conclusion because the number of args seems the only
difference between the test that compiles OK and the one that doesn't.
The code was copy&pasted from:

and the function object there only accepts `int` as it's first
argument. So, does that compile because any of the
alternative types can be converted to `int`?

Hmmm. Changed the all types of the lamba args to auto and
it still fails to compile :( Why is that?

It would illustrate better how to use `visit` if you provided
some examples other than those in the test directory.

I'm also having a hard time understanding how the implementation
  works. Maybe some in source comments
would help there.


Boost list run by bdawes at, gregod at, cpdaniel at, john at