Boost logo

Boost Users :

From: Sam Gentile (ManagedCode_at_[hidden])
Date: 2002-11-12 15:45:16


John and others,

 

I went there and indeed it can't get any simpler - at least in theory-)
Read the document
C:\Boost\boost_1_29_0\libs\type_traits\c++_type_traits.htm and its quite
simple:

template <typename T>
struct is_void
{ static const bool value = false; };
 
template <>
struct is_void<void>
{ static const bool value = true; };

 

 

That's exactly what I want to show. So I go to the header files and
instead:

//* is a type T void - is_void<T>

BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_void,T,false)

BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_void,void,true)

 

Huh? So I look in bool_trait_def.hpp:

#define BOOST_TT_AUX_BOOL_TRAIT_DEF1(trait,T,C) \

template< typename T > struct trait \

    : mpl::bool_c< C > \

{ \

    BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \

    BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \

}; \

 

Argh! Why is it done like this? This makes it much more complicated and
unreadable than it has to be. Why are macros being used everywhere?

 

 

Sam Gentile

.NET Consultant

ManagedCode_at_[hidden]

http://www.samgentile.com

http://radio.weblogs.com/0105852/

 

-----Original Message-----
From: John Maddock [mailto:john_maddock_at_[hidden]]
Sent: Sunday, November 10, 2002 7:01 AM
To: Boost-Users_at_[hidden]
Subject: Re: [Boost-Users] A strange question-)

 

> Thanks for your reply. Yes, I know. VC++ 7.1 does handle all of Boost
> correctly and compiles 100% of it correctly. Given that, let me try my
> question again. What parts of Boost best emplify advanced uses of
> templates such as Partial Template Specialization and are
understandable
> in small pieces? The goal is to put together a "teaching demo" on
things
> like Partial Template Specialization and then show how it is used in
> practice in libraries like Boost. Thanks in advance.

How about the type traits remove_XXX templates? Or even some of the
is_XXX
templates, although the latter tend to have rather a lot of workarounds
cluttering up the code.

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm

Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>

Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/> Terms of Service.

[Non-text portions of this message have been removed]


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net