Meaning of or_<> with empty arguments

Hi, This code compiles:- #include <boost/mpl/or.hpp> using boost::mpl; int main() { typedef boost::mpl::or_<> A; A a; } What is the meaning an empty or_<> ? On my gcc compiler I can see that there is no type/value inside A. With Regards, Reetesh Mukul

Reetesh Mukul a écrit :
Hi,
This code compiles:-
If you don't have, get a book about C++ ;) . Templates can have default parameters like functions : template<typename LEFT = bool, typename RIGHT = bool> compare(LEFT, RIGHT) ; -- Mickaël Wolff aka Lupus Michaelis Racine <http://lupusmic.org> Blog <http://blog.lupusmic.org>

Mickael Wolff <mickael <at> lupusmic.org> writes:
Reetesh Mukul a écrit :
Hi,
This code compiles:-
If you don't have, get a book about C++ ;) . Templates can have default parameters like functions :
template<typename LEFT = bool, typename RIGHT = bool> compare(LEFT, RIGHT) ;
;) This I know. I meant something very different. I wanted to ask what can be the meaning of "or" operation on an empty list/vector of parameters. Here or_<> is provided an empty set of parameters. Now looking into code of or_<> it appears that for no-parameters, it will inherit from false_. But when I have compiled code ( in my last mail ) using gcc (4.1), I saw that there were no "type" inside or_<>. Typically or_<T1,T2..> has a type in it. Strange enough, but reasonable, or_<na,na,na> has a type inside it ( the false_ one ). Now if suppose or_<> to false, how one is going to evaluate typedef and_<true_,true_,or_<> > tto; So please clear my gcc observation and the mathematical context of or_<>. With Regards, Reetesh Mukul

Reetesh Mukul a écrit :
;) This I know. I meant something very different.
Ok, but you could agree you didn't ask about the semantic :D
I wanted to ask what can be the meaning of "or" operation on an empty list/vector of parameters. Here or_<> is provided an empty set of parameters.
In fact, I don't understand too. It is maybe a limitation due to the use of macro for emulating variadic templates ?
Now if suppose or_<> to false, how one is going to evaluate
I made tests too. And op_<>::operator bool() doesn't exist if we don't indicate at least one template argument. So I can't help you anymore. -- Mickaël Wolff aka Lupus Michaelis Racine <http://lupusmic.org> Blog <http://blog.lupusmic.org>
participants (2)
-
Mickael Wolff
-
Reetesh Mukul