[typeof] Duplicate definition of type_of::push_back

[Note: This message received no response when posted to comp.lib.boost.user, so I'm reposting it here.] Hi, I'm testing with BOOST_TYPEOF_LIMIT_SIZE greater than 50 and native typeof disabled. I get a "class template has already been defined" error on "template<class V, class T> struct push_back" whenever BOOST_TYPEOF_LIMIT_SIZE is *not* a multiple of 50. This is because push_back is defined in both "typeof/vector.hpp" and, for example, "typeof/vector50.hpp". My fix is to change the push_back definition in "typeof/vector.hpp" to: # if BOOST_TYPEOF_LIMIT_SIZE < 50 template<class V, class T> struct push_back { typedef V type; }; # endif Can someone please confirm that this is the correct fix? A tiny program demonstrating the problem is listed below. Thanks, Dave Jenkins #define BOOST_TYPEOF_COMPLIANT #define BOOST_TYPEOF_LIMIT_SIZE 51 #include <boost/typeof/typeof.hpp> int main(){ return 0; }

2007/10/24, Dave Jenkins <david@jenkins.net>:
[Note: This message received no response when posted to comp.lib.boost.user, so I'm reposting it here.]
Hi, I'm testing with BOOST_TYPEOF_LIMIT_SIZE greater than 50 and native typeof disabled. I get a "class template has already been defined" error on "template<class V, class T> struct push_back" whenever BOOST_TYPEOF_LIMIT_SIZE is *not* a multiple of 50.
This is because push_back is defined in both "typeof/vector.hpp" and, for example, "typeof/vector50.hpp". My fix is to change the push_back definition in "typeof/vector.hpp" to:
# if BOOST_TYPEOF_LIMIT_SIZE < 50 template<class V, class T> struct push_back { typedef V type; }; # endif
Can someone please confirm that this is the correct fix? A tiny program demonstrating the problem is listed below. Thanks, Dave Jenkins
#define BOOST_TYPEOF_COMPLIANT #define BOOST_TYPEOF_LIMIT_SIZE 51 #include <boost/typeof/typeof.hpp> int main(){ return 0; }
Fixed in trunk. Thanks for spotting this, and sorry for the slow response. Peder _______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Dave Jenkins
-
Peder Holt