Conversation
We defined operator{<<,>>} for pcg128_t in pcg_extras, assuming Koenig
lookup would find these as needed. This isn't actually true, because
pcg128_t is a typedef, and Koenig lookup doesn't apply to the
namespaces of typedefs. We would need to define those operators in
the global namespace; that's a bad idea.
Instead, work around it. Define explicit Input and Output functions
in the namespace, which in turn default to operator<< and operator>>
if they need to, and explicitly use them in engine printing/parsing
functions.
|
Note that I do not intend for this to merged as-is; it's incomplete (I need to do the same thing for uint8 handling and for extended-generator printing. Figured I'd demonstrate what the approach looks like and see if we can come to a consensus before I wrote out all the details. Thoughts? |
| pcg_extras::Output(out, rng.increment()); | ||
| out << space; | ||
| pcg_extras::Output(out, rng.state_); | ||
| out << space; |
There was a problem hiding this comment.
Note this change is intentional: the current parsing routine for pcg128_t is actually broken at EOF. (This only showed up with this change, as it's not used anywhere currently.
|
I would love for this to be merged (I would like checkpointing with It is of course unfortunate not to be able to use |
We defined operator{<<,>>} for pcg128_t in pcg_extras, assuming Koenig
lookup would find these as needed. This isn't actually true, because
pcg128_t is a typedef, and Koenig lookup doesn't apply to the
namespaces of typedefs. We would need to define those operators in
the global namespace; that's a bad idea.
Instead, work around it. Define explicit Input and Output functions
in the namespace, which in turn default to operator<< and operator>>
if they need to, and explicitly use them in engine printing/parsing
functions.