From: Alexander Grund (alexander.grund_at_[hidden])
Date: 2024-12-03 12:46:27


Am 03.12.24 um 12:47 schrieb Ivan Matek via Boost:
>> And you never do this
>>
>> boost::hash2::hash_append( h, {}, v.x );
>> boost::hash2::hash_append( h, {}, v.y );
>> boost::hash2::hash_append( h, {}, v.z );
>>
>> You do this instead
>>
>> boost::hash2::hash_append( h, f, v.x );
>> boost::hash2::hash_append( h, f, v.y );
>> boost::hash2::hash_append( h, f, v.z );
>
> Yes, but then again I am passing f multiple times. I don't want it to sound
> like I am making a big deal out of this, I can just do something like(and I
> actually use this idiom a lot)
> const auto append = [&] (const auto& val){hash_append (h, f, val);}
> and use that "partially applied" helper, in case I actually need to do
> hash_append multiple times.
I think there is space for such a helper:
 Â Â Â  boost::hash2::hasher append(h, f); // Or ...::hasher append(h) for
default flavor
 Â Â Â Â append(v.x);
 Â Â Â  append(v.y);
 Â Â Â  append(v.z);

As the equivalent for the above sequence. Basically make your lambda
available as a named type.
That might make it easier given that the flavor at the 2nd cannot be
defaulted.