Suppose I am a user of a Certain Template Library (CTL
) which defines a template, named, say, Hector
template <class T> class Hector {...};
And in its documentation it gives many guarantees about Hector
template behavior. But then it also defines a specialization for a certain type Cool
template <> class Hector<Cool> {....};
The purpose of the specialization is a more optimized implementation of Hector
, but unfortunately because of this optimization many guarantees of Hector
are violated.
Currently I really don't need the optimization, I'd rather preserve all the guarantees of Hector
. Is there any way I could, without changing the library code (CTL
is a highly respectable library, you know), circumvent the specialization? Any way at all? Maybe write some sort of wrapper? Anything? I just want to the compiler to generate code for Hector<Cool>
in a normal, non-optimized way, with all the guarantees.
Are you able to use the related template Reque
that doesn't have the undesired specialization? Otherwise I think you'd need to create a wrapper for Cool
so that the specialization isn't used.
You could wrap cool in a dummy type to prevent the template from specializing it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With