Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 1
    This is by far the BEST answer to the eternal questions about how/why/if/when to use some tricks to emulate an static constructor in C++. Commented Sep 3, 2014 at 7:29
  • @bearvarine As for your recent question on Meta-SO. Yes, this is one of the questions, that won't survive at SO nowadays. I'm close voting many questions of this form everyday Because I think their value for future researchers is minor (or there is a duplicate already), and the OP has been missing to research the site before asking their own question. The moderation tone has changed, especially for questions kind of this caliber, since the answers are already ubiquitously available meanwhile. Commented Mar 31, 2015 at 18:43
  • This leads to the following Error in VS2017: Severity Code Description Project File Line Suppression State LNK2001 unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > Foo::my_text_str" (?my_text_str@Foo@@2V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) Commented Jul 29, 2017 at 12:26
  • I have just hit this problem. And your solution is not always possible in the real world projects where you did not write the code from scratch and all by yourself. Commented Sep 28, 2018 at 22:32