diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-24 10:43:35 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-24 10:43:35 +0200 |
commit | 16632e04c20599fd02737f0ad6d8f94d46f038bf (patch) | |
tree | f58dc21a1b07045e6f146ff401de55bc4056984b /common/bulk/test.hxx | |
parent | b9f83d0d666037b7f7728b674362d365470a244a (diff) |
Test class templates
Diffstat (limited to 'common/bulk/test.hxx')
-rw-r--r-- | common/bulk/test.hxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/common/bulk/test.hxx b/common/bulk/test.hxx index 8497174..526762f 100644 --- a/common/bulk/test.hxx +++ b/common/bulk/test.hxx @@ -155,4 +155,38 @@ namespace test5 }; } +// Test API with persistent class template instantiations. +// +#pragma db namespace table("t6_") +namespace test6 +{ + template <int> + struct object_template + { + object_template (unsigned int n_ = 0, std::string s_ = "") + : id (0), n (n_), s (s_) {} + + unsigned long id; + unsigned int n; + std::string s; + }; + + typedef object_template<1> object; + + #pragma db object(object) bulk(3) + #pragma db member(object::id) id auto + + typedef object_template<2> auto_object; + + #pragma db object(auto_object) bulk(3) pointer(std::auto_ptr) + #pragma db member(auto_object::id) id auto + +#ifdef HAVE_CXX11 + typedef object_template<3> unique_object; + + #pragma db object(unique_object) bulk(3) pointer(std::unique_ptr) + #pragma db member(unique_object::id) id auto +#endif +} + #endif // TEST_HXX |