c++ - Boost.TTI not working with Clang -


boost 1.54 added new library, boost.tti type traits introspection. following code using has_template functionality, works on g++ not on clang

#include <boost/tti/has_template.hpp>  boost_tti_has_template(template1) boost_tti_has_template(template2) boost_tti_has_template(template3)  struct top {   template <class x> struct template1 { };   template <typename a,typename b,typename c> class template2 { };   template <typename a,typename b,typename c,int d> class template3 { }; };  int main() {     static_assert( has_template_template1<top>::value, ""); // true     static_assert( has_template_template2<top>::value, ""); // true     static_assert(!has_template_template3<top>::value, ""); // false, not typename/class template parameters } 

live example.

question: why doesn't code compile on clang? according boost.tti docs, support variadic macros required, clang has been supporting since 2.9.

boost_tti_has_template uses variadic macros boost.preprocessor. the maintainer of library not want depend on boost.config , believes macro config defines not "strong enough" preprocessor metaprogramming library.. these reasons use of variadic versions of boost_tti_has_template depends on whether boost_pp_variadics defined. sadly, code automatically determining if compiler has variadic macro support out of date , not include clang amongst compilers variadic support on. recommended workaround defining boost_pp_variadics=1.

apparently has been solved in trunk, , may possibly included in future release.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -