c++ - Force Templated Constructor to Run? -


I understand that the inlet is the trick to be forced to create a global object where it is used. It is used for std :: cout believe me.

  #ifndef GUARD_H # Defined GUARD_H class magical {// default constructor and such ...}; Class init {public: init (); }; External magical amp; Magic; Namespace {Init __magical_initializer; // this works as an object, created in each source file) it is included in #endif   

src:

  #include "magical.h" # Include & lt; New & gt; Static count; // believe that there is a sample, which says that global integers are started with zero fixed alignment (magical) four buffers [sums (magical)]; Magical & amp; Magic = * re-reference & lt; Magical * & gt; (Buffer); Init :: init () {if (! Count ++) {new (buffer) magical; }}   

I was thinking that there is a template in it because my code would look something like this:

  template < Typename T & gt; Class base {Static magical & lt; T & gt; __private; // need to call this consignor}; // Usage: Class some class: public base & lt; SomeClass & gt; {};    

There is no way to resolve this problem because the template does not exist in source files Can be

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -