Description
The library works well when I use Fedora 23 whose gcc's version is gcc-c++-5.3.1-6.fc23.x86_64.rpm.
But after I updated to Fedora 24 in which gcc's version is gcc-c++-6.1.1-3.fc24.x86_64.rpm, the problem occurred.
When I compiling my project, It shows:
In file included from nb.cc:5:0:
/usr/local/include/sqlite_modern_cpp.h:494:25: error: template-id ‘get_col_from_db<>’ for ‘void sqlite::get_col_from_db(sqlite::database_binder&, int, std::__cxx11::string&)’ does not match any template declaration
template<> inline void get_col_from_db(database_binder& db, int inx, std::string & s) {
^~~~~~~~~~~~~~~
/usr/local/include/sqlite_modern_cpp.h:454:35: note: candidates are: template<class T> void sqlite::get_col_from_db(sqlite::database_binder&, int, std::vector<Type>&)
template<typename T> inline void get_col_from_db(database_binder& db, int inx, std::vector<T>& vec) {
^~~~~~~~~~~~~~~
/usr/local/include/sqlite_modern_cpp.h:483:35: note: template<class T> void sqlite::get_col_from_db(sqlite::database_binder&, int, std::unique_ptr<T>&)
template<typename T> inline void get_col_from_db(database_binder& db, int inx, std::unique_ptr<T>& _ptr_) {
^~~~~~~~~~~~~~~
/usr/local/include/sqlite_modern_cpp.h:507:37: error: template-id ‘operator<< <>’ for ‘sqlite::database_binder& sqlite::operator<<(sqlite::database_binder&, const string&)’ does not match any template declaration
template<> inline database_binder& operator <<(database_binder& db, const std::string& txt) {
^~~~~~~~
/usr/local/include/sqlite_modern_cpp.h:444:47: note: candidates are: template<class T> sqlite::database_binder& sqlite::operator<<(sqlite::database_binder&, const std::vector<Type>&)
template<typename T> inline database_binder& operator<<(database_binder& db, const std::vector<T>& vec) {
I'm very confused.
After I reading this article -- Why Not Specialize Function Templates?, I think it may due to the specialized function templates.
So I replace all specialized function templates with nontemplate functions and add them to be friends of class database_binder in file /usr/local/include/sqlite_modern_cpp.h
.
And then it works.
Although this solved my problem, but I think it may be not the best way.
Here is my solution: Comparing changes