Boost C++ Libraries: Ticket #3442: tracking level etc. for templates https://svn.boost.org/trac10/ticket/3442 <p> changing the tracking level/class implementation for tempaltes is very tedious to write and reveals implementation details to the user, so I'm suggesting the following macro: </p> <p> template&lt;class T,int i&gt; class mytype{}; </p> <p> BOOST_CLASS_TRACKING_TEMPLATE(mytype,2,(class,int),track_never); </p> <p> the implementation is fairly simple: </p> <p> #define TYPE_TO_PAR(R,DATA,I,ELEM) (ELEM _A##I) #define PAR_SEQ(NR,PARS) BOOST_PP_SEQ_FOR_EACH_I(TYPE_TO_PAR,0,BOOST_PP_TUPLE_TO_SEQ(NR,PARS)) #define PARS(NR,PARS) BOOST_PP_SEQ_ENUM(PAR_SEQ(NR,PARS)) #define ARGS(NR) BOOST_PP_ENUM_PARAMS(NR,_A) </p> <p> #define BOOST_CLASS_TRACKING_TEMPLATE(T,NR,P,TRACKING) \ template&lt;PARS(NR,P)&gt; struct tracking_level&lt;T&lt;ARGS(NR)&gt; &gt; { </p> <blockquote> <p> typedef mpl::integral_c_tag tag; typedef mpl::int_&lt;TRACKING&gt; type; BOOST_STATIC_CONSTANT( </p> <blockquote> <p> int, value = tracking_level::type::value </p> </blockquote> <p> ); </p> </blockquote> <p> }; </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3442 Trac 1.4.3 anonymous Sat, 12 Sep 2009 16:54:08 GMT <link>https://svn.boost.org/trac10/ticket/3442#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3442#comment:1</guid> <description> <p> let me know if you agree with this but don't think it's worth your effort. I'll write a patch. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Wed, 16 Sep 2009 04:58:36 GMT</pubDate> <title>severity changed https://svn.boost.org/trac10/ticket/3442#comment:2 https://svn.boost.org/trac10/ticket/3442#comment:2 <ul> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Cosmetic</span> </li> </ul> <p> Hmm - took me a while to figure this out. Very clever. </p> <p> I'm not sure it's worth it though. This would mean </p> <p> a) implementing this for ALL serialization traits not just one b) Adding explanation to the documentation c) Making tests to prove that it works on all compilers </p> <p> So there's a fair bit of work involved. If you're still interested let me know </p> Ticket anonymous Wed, 16 Sep 2009 22:21:21 GMT <link>https://svn.boost.org/trac10/ticket/3442#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3442#comment:3</guid> <description> <p> not immediatly, but I'll put it on my todo-list. I'm using this in a library I'm planning to submit for review, which requires the user to also use boost.serialization so it would be nice if that matched if the library will be accepted. </p> <p> I'm only aware of tracking and imlpementation level, I have to look up what the other serialization traits are. </p> <p> the thing I can't do is c) as I only have 2 compilers available. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 21 Sep 2009 20:57:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3442#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3442#comment:4</guid> <description> <p> which syntax do you prefer? </p> <p> BOOST_CLASS_TRACKING_TEMPLATE(mytype,2,(class,int),track_never); or BOOST_CLASS_TRACKING_TEMPLATE(mytype,(class)(int),track_never); </p> <p> (class,int) without an argument which gives the number of template parameters is not a possibility </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Fri, 22 Apr 2011 18:30:56 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3442#comment:5 https://svn.boost.org/trac10/ticket/3442#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> Looking over all my items. I think I've come to terms with this. </p> <p> It's a worthy idea. But I think it's too complicated to add to the library. </p> <p> Also, it's not really an issue of serialization library, Rather it's an issue of exporting type traits in general. I think you should formulate this as an idea for boost and inquire on the list. </p> <p> Robert Ramey </p> Ticket