
Sascha Krissler wrote:
Fernando wrote:
[...] But when i store values where the type has an inline NaT value (for example NULL pointers) i cannot and need not use optional.
Can you explain why you cannot use optional<>? I definitely see that you don't need it, but for the sake of genericity I just wouldn't mind the fact that some types do have an identifiable null value and use optional<> all along.
Well i could use it but i do not want to. The space complexity is linear as i have to store it for every entry and a perfect hash could grow alot even for a small number of entries.
So your problem boils down to sizeof(optional<T>)=sizeof(T)+sizeof(bool)? I'm not sure I like your proposal from a semantic POV, so it might help if you could give more detail that just "optional is bigger than I want". Can you show me a _concrete_ example for the iniline NaT case? Along with an example of a non inline case? TIA Fernando Cacciola