3 ms·
Again, can you provide an example or two? Its hard to agree or disagree without an example. I think all C++ wild template stuff can be done via proc macros. Eg
by josephg 10mo ago
Again, can you provide an example or two? Its hard to agree or disagree without an example.
I think all C++ wild template stuff can be done via proc macros. Eg, in rust you can add #[derive(Serialize, Deserialize)] to have a highly performant JSON parser & serializer. And thats just lovely. But I might be wrong? And maybe its ugly? Its hard to tell without real examples.
- steveklabnik 10mo agoSpecialization isn’t stable in Rust, but is possible with C++ templates. It’s used in the standard library for performance reasons. But it’s not clear if it’ll ever land for users.
- tick_tock_tick 10mo agoRust doesn't allow specialization and likely never will because it's unsound https://www.reddit.com/r/rust/comments/1p346th/specialization_whats_unsound_about_it/ https://www.reddit.com/r/rust/comments/1p346th/specializatio... has a couple of nice comments about it. But yes it's basically template <typename T, size_t N> class Example { vector<T> generic; }; template<> class Example<int32_t, 32> { int bitpackinhere; }