just restrict the template to the desired type/types while we are on it, why isn't you vec type templated? just template that out and specialize on vec and vec.
Jose Green
Learn lisp.
Robert Mitchell
hash
Carson Robinson
template specializations is better because i can use it with std::unordered_set without anyone else to write stupid code like. std::unordered_set
Bentley Williams
I believe you can reduce it to a single function and just use "if constexpr(...)" with std::is_same to check if it's the type you want.
Jayden Gray
template class hash { public: size_t operator()(const T& v) const { static_assert( std::is_pod()::value, "use pod idiot"); return pod_hash(v); } }:
Carter Miller
there we go
Gavin Murphy
so don't do that then
Chase Morgan
use typetraits with sfinae or constexpr_if u retard
maybe I am missing something can you explain it a little bit more. puh can i extend std::hash with a template? as far as i know only template specializations is allowed
i need std::hash cant write my own hash class because it has to work with std library code.
also i don't want to modify vec type because its also library code. maintaining so much stuff is hard.
This isn't a template specialization of std::hash any longer.
Ethan Phillips
don't worry they will make it in c++23
Owen Roberts
you could use concepts in 2017 if you enabled the flag in gcc lol
Matthew Smith
but will it compile in 2023? Thank you
Leo Foster
If pod_hash already knows what is a valid template type, why bother trying to implement this hash wrapper?
Liam Adams
Make a trait that all of those traits/structs implement and use that instead.
Xavier Roberts
kill yourself
Ryan Jones
nah
Brody Watson
vec can implement a user-made trait
Joshua Roberts
pajeet, my son you are decent programmer now must choose between clean, safe, orthogonal Rust traits and the hacky copy of them that isn't even implemented in C++ itself and with which nothing else in C++ works nicely