J
Jonathan Lee
Hi all,
I have a couple situations where I've written a template class that
has static data or static functions that are the exact same no matter
what the template type is. So I've been pulling the code out into a
dummy namespace, or a dummy class that the template inherits from
because I don't want the code duplicated. But *then* I figure this
stuff doesn't belong in a header so I move that stuff to a .cpp file,
which destroys one of the things I like about templates: everything
in one header.
Is there a better way to:
- avoid code/data duplication
- hide these functions from the outside world
- ideally keep it all in one header
--Jonathan
I have a couple situations where I've written a template class that
has static data or static functions that are the exact same no matter
what the template type is. So I've been pulling the code out into a
dummy namespace, or a dummy class that the template inherits from
because I don't want the code duplicated. But *then* I figure this
stuff doesn't belong in a header so I move that stuff to a .cpp file,
which destroys one of the things I like about templates: everything
in one header.
Is there a better way to:
- avoid code/data duplication
- hide these functions from the outside world
- ideally keep it all in one header
--Jonathan