10-23-2011, 12:34 PM
I discovered something weird while I was learning C++.
When you create a class with a templated function, you can only use it within the file you created the function (not the prototype).
I was wondering if anyone knew how to fix this, since it is rather annoying.
Example: Here.
If you move the function from "CApp_String.cpp" to "CApp.cpp" it works perfectly fine.
I've only tested it using the MingW compiler on Windows, so I don't know if it is any different with any other compiler.
When you create a class with a templated function, you can only use it within the file you created the function (not the prototype).
I was wondering if anyone knew how to fix this, since it is rather annoying.
Example: Here.
If you move the function from "CApp_String.cpp" to "CApp.cpp" it works perfectly fine.
I've only tested it using the MingW compiler on Windows, so I don't know if it is any different with any other compiler.
Age ratings for movies and games (and similar) have never been a good idea.
One can learn a lot from reinventing wheels.
An unsound argument is not the same as an invalid one.
volatile in C++ does not mean thread-safe.
Do not make APIs unnecessarily asynchronous.
Make C++ operator > again
Trump is an idiot.
One can learn a lot from reinventing wheels.
An unsound argument is not the same as an invalid one.
volatile in C++ does not mean thread-safe.
Do not make APIs unnecessarily asynchronous.
Make C++ operator > again
Trump is an idiot.