I am pretty new to c++ and I have the following error:
error: explicit specialization of 'get' in class scope
template <> string get<string>() {
This is the code
class ReadFile {
public:
template <typename T> T get() {
//...
}
template <> string get<string>() {
//...
}
private:
//...
};
By reading the error code, I wrote the template function outside the class scope and I got this error:
duplicate symbol __ZN8ReadFile3getINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEET_v in:
So if that is not working how should it be written? Thank you for any help!
When I wrote it ooutside the class scope I wrote it this way:
class ReadFile {};
template <> string ReadFile::get<string>() {
//...
}