Is there any difference in these codes:
std::string dirName = argv[1];
MyRecordDatabaseType myDB(Selector<std::string>((std::string)dirName));
and
std::string dirName = argv[1];
MyRecordDatabaseType myDB(Selector<std::string>(dirName));
I have no idea why the second version doesn’t compile.
The compiler tells me:
error: request for member ‘createGroupWriter’ in ‘myDB’, which is of non-class type ‘main(int, char**)::MyRecordDatabaseType(Selector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)’
at line:
MyRecordDatabaseType::writer_type myWriter(myDB.createGroupWriter(groupName));
And sorry, but I can’t show you the code of Selector or any other class.
Maybe you can help me without that?
Yes, the difference is that this line
can also be written like
and is a declaration of a function
myDBthat returnsMyRecordDatabaseType.See C++ most vexing parse