www.digitalmars.com         C & C++   DMDScript  

c++ - Constructor not called

The constructor and destructor of the template class are never called in
this test-case (it would work with a non-template class):

#include <stdio.h>

template<class T>
struct B
{
 public:
  B()
  {
    printf("B::B\n");
  }

  ~B()
  {
    printf("B::~B\n");
  }
};

int main(int argc, char *argv[])
{
  B<int> b[1];

  return 0;
}
		     

bye, Christof

-- 
http://cmeerw.cjb.net                          Jabber: cmeerw jabber.at
mailto cmeerw at web.de                   ICQ: 93773535, Yahoo!: cmeerw

...and what have you contributed to the Net?
Oct 21 2001