
Dave, thanks for your answer. I think this should be definitely a part of FAQ, otherwise someone could spent endless hours on matters why some of boost classes do not work as expected. I have one more question. I tried the following code with VC 8.0: #include <boost/mpl/has_xxx.hpp> struct test2 { typedef int xxx; }; BOOST_MPL_HAS_XXX_TRAIT_DEF(has_xxx) typedef has_xxx my_test; And got a compiler error: main.cpp(22) : error C2146: syntax error : missing ';' before identifier 'my_test' Somehow the macro was not expanded. I replaced xxx with some other name before but end up in compiler errors, so that I decided to check if the standard example is compilable at all by using the typedef. Do you have any suggestions? Thanks, Ovanes -----Original Message----- From: David Abrahams [mailto:dave@boost-consulting.com] Sent: Saturday, June 24, 2006 04:51 To: boost-users@lists.boost.org Subject: Re: [Boost-users] inspecting templates and boost::is_pointer "Ovanes Markarian" <om_boost@keywallet.com> writes:
Hello all,
I am trying to specialize boost::is_pointer so, that it can determine if a type is a pointer wrapper (shared_ptr, auto_ptr, weak_ptr).
First of all, don't do that. It's a really bad idea, and it will probably break some (Boost) library code. is_pointer is supposed to detect real pointers, and if you start changing what it does with other types, you'll break the expectations of every bit of code that currently uses is_pointer. This has come up before, so maybe it should be a FAQ (John?)
Does anybody has ideas how this can be done? May be it would be possible to handle if e.g. one can determine if a class/struct has some typedef inside:
http://www.boost.org/libs/mpl/doc/refmanual/has-xxx-trait-def.html -- Dave Abrahams Boost Consulting www.boost-consulting.com