[Boost-users] serialization with templates

28 views
Skip to first unread message

Unger, Jörg F.

unread,
Jul 12, 2012, 5:18:56 AM7/12/12
to boost...@lists.boost.org

I’m trying to serialize a template class with multiple template parameters. In the header file, I declare something like

 

template <int T1, int T2>

class Node

{

private:

std::array<double,T1> first;

std::array<double,T2> second;

}

 

BOOST_CLASS_EXPORT_KEY(Node<1,1>)

 

In a separate file, I would use the BOOST_CLASS_EXPORT_IMPLEMENT macro. However, when I’m using the BOOST_CLASS_EXPORT_KEY with  a class that has more than one template parameter (as in the example above), I get an error message

Error: macro "BOOST_CLASS_EXPORT_KEY" passed 2 arguments, but takes just 1

 

I’m using gcc 4.7.1 with boost 50

 

Any ideas, how to solve that problem?

 

Jörg F.

niXman

unread,
Jul 12, 2012, 10:27:21 AM7/12/12
to boost...@lists.boost.org
2012/7/12 Unger, Jörg F.:

> BOOST_CLASS_EXPORT_KEY(Node<1,1>)

-

#include <boost/utility/identity_type.hpp>

BOOST_CLASS_EXPORT_KEY(BOOST_IDENTITY_TYPE((Node<1,1>)))

--
Regards,
niXman
___________________________________________________
Dual-target(32 & 64 bit) MinGW compilers for 32 and 64 bit Windows:
http://sourceforge.net/projects/mingwbuilds/
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Viatchesla...@h-d-gmbh.de

unread,
Jul 12, 2012, 10:27:23 AM7/12/12
to boost...@lists.boost.org
On Thu, 12 Jul 2012 11:18:56 +0200, Unger, Jörg F. <joerg...@bam.de>
wrote:


Hi,

My boost 1.47 does not have BOOST_CLASS_EXPORT_KEY but I suppose this is a
macro, therefore there is a problem with comma in template. Try to use
typedef or maybe BOOST_PP_COMMA may help here.

-- Slava

Reply all
Reply to author
Forward
0 new messages