[odb-users] Persisting class instantiated from a template

Balázs Bayer balazs.bayer at gmail.com
Sat Mar 18 06:33:45 EDT 2017


actually one more thing:

with this:

int Id = 1;
std::array<float, 7> Values = {{0, 1, 2, 3, 4, 5, 6}};
ResultFloatSeven S(Values, Id);

{
    std::unique_ptr<odb::database> db(new odb::sqlite::database(
        "./test.db", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE));

    odb::transaction t(db->begin());
    db->persist(S);
    t.commit();
}

Now I get the following compilation error for the line "db->persist(S);":

In file included from main.cpp:9:
In file included from /usr/include/odb/sqlite/database.hxx:16:
In file included from /usr/include/odb/database.hxx:23:
/usr/include/odb/traits.hxx:178:5: error: implicit instantiation of
undefined template 'odb::access::object_traits_impl<result::Result<float,
7>, 5>'
    access::object_traits_impl<T, DB>,
    ^
/usr/include/odb/database.txx:38:5: note: in instantiation of template
class 'odb::object_traits_impl<result::Result<float, 7>, 5>' requested here
    object_traits::persist (*this, obj);
    ^
/usr/include/odb/database.ixx:160:12: note: in instantiation of function
template specialization 'odb::database::persist_<result::Result<float, 7>,
5>' requested here
    return persist_<T, id_common> (obj);
           ^
main.cpp:27:9: note: in instantiation of function template specialization
'odb::database::persist<result::Result<float, 7> >' requested here
    db->persist(S);
        ^
/usr/include/odb/forward.hxx:99:11: note: template is declared here
    class object_traits_impl;
          ^
In file included from main.cpp:9:
In file included from /usr/include/odb/sqlite/database.hxx:16:
In file included from /usr/include/odb/database.hxx:632:
/usr/include/odb/database.txx:38:18: error: incomplete definition of type
'odb::object_traits_impl<result::Result<float, 7>, 5>'
    object_traits::persist (*this, obj);
    ~~~~~~~~~~~~~^~
/usr/include/odb/database.ixx:160:12: note: in instantiation of function
template specialization 'odb::database::persist_<result::Result<float, 7>,
5>' requested here
    return persist_<T, id_common> (obj);
           ^
main.cpp:27:9: note: in instantiation of function template specialization
'odb::database::persist<result::Result<float, 7> >' requested here
    db->persist(S);
        ^
In file included from main.cpp:9:
In file included from /usr/include/odb/sqlite/database.hxx:16:
In file included from /usr/include/odb/database.hxx:632:
/usr/include/odb/database.txx:40:29: error: no member named
'reference_cache_traits' in 'odb::object_traits_impl<result::Result<float,
7>, 5>'
    typename object_traits::reference_cache_traits::position_type p (

Any idea?

Thanks,
Balazs


More information about the odb-users mailing list