00:56:12 @vtnerd do you think compilers will be smart enough to unroll the `for_each` in this function into a single O(1) lookup? 00:56:52 Which function? 00:57:31 Lol I forgot to link: https://github.com/jeffro256/monero/blob/2e0f9b3b1a351a7dd5362b9fe0a00f6ff05855bd/src/common/variant.h#L175 01:16:24 So you want this to "jump" to the element given as an integer? It _might_ do that, but it could also punt and generate a generic function with `which` as a runtime value. My best guess is that it will do the latter, but I dunno it's plausible that everything gets unlined and optimized 01:16:40 *inlined 01:18:16 Yes that's the goal 01:18:45 Without writing an explicit `switch/case` for different variant types 01:21:06 You also should consider a switch to std::variant, it has an emplace function which does exactly this, and has a std::monostate. One downside is that it can have "valueless" on exception whereas boost guarantees a value even with exceptions 01:22:22 Oh we DID move to c++17.... 01:23:27 Yeah, that's what I was thinking. But the differences might not be worth it. But it does have an emplace, which looks k to be the goal here 01:28:36 Oh but that emplace requires you to know the index at compile time 01:31:35 I was looking for a way to value initialize in O(1) which a run-time index, specifically to be used in deserialization 01:31:51 s/which/with 01:39:08 Ah right, you wanted the runtime value. I think most compilers are unlikely to create a jump table, probably similar to an if/else ladder, but I don't know it's probably close 01:40:21 Thanks for looking btw