4/28/2023 0 Comments Hpp hack§3.2.6 and the following paragraphs from the current c++ 17 draft (n4296) define the rules when more than one definition can be present in different translation units: However, you can define static member functions! Now, at first sight that may not look as if it could help except, of course, that function can have local static variable and returning a reference to one of these behaves nearly like a static member variable: static std::string& bstring(), depending on the order of initialization created by the linker. Since the include guards are only affecting the compilation of one translation unit, they won't help, either. If you put variable definitions into a header, it is going to be defined in each translation unit where the header is included. You can't define a static member variable more than once.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |