M
Mark P
Is there any way to forward declare STL container classes such as list,
set, map, etc.? (My impression is that there isn't, since these are all
defined in std.)
Failing that, consider the following snippet of code:
//////////
#include <list>
template <class Ty = int>
struct Foo
{
typedef std::list<Ty> Type;
};
//////////
If this block of code were included in a translation unit that never
made any further reference to Foo or Foo::Type, is it reasonable to
assume that the compiled code would not be any larger? (I understand
this is an implementation issue, but your experience and intuition would
be very helpful.) FWIW, my testing on gcc indicates no difference.
[If you're curious, I have a bunch of these wrapped typedefs for various
STL container classes which I use to supply my own default allocator.
This in turn simplifies the client syntax significantly. However,
they're all stuck together in a single header file which includes many
of the STL container headers, even though any particular user of the
header may only need some of them.]
Thanks,
Mark
set, map, etc.? (My impression is that there isn't, since these are all
defined in std.)
Failing that, consider the following snippet of code:
//////////
#include <list>
template <class Ty = int>
struct Foo
{
typedef std::list<Ty> Type;
};
//////////
If this block of code were included in a translation unit that never
made any further reference to Foo or Foo::Type, is it reasonable to
assume that the compiled code would not be any larger? (I understand
this is an implementation issue, but your experience and intuition would
be very helpful.) FWIW, my testing on gcc indicates no difference.
[If you're curious, I have a bunch of these wrapped typedefs for various
STL container classes which I use to supply my own default allocator.
This in turn simplifies the client syntax significantly. However,
they're all stuck together in a single header file which includes many
of the STL container headers, even though any particular user of the
header may only need some of them.]
Thanks,
Mark