ice_and/or vs. mpl::and_/or_

Hi, Is there any difference between boost::type_traits::ice_and (ice_or) and boost::mpl::and_ (or_)? Should one be preferred over the other in the implementation of other Boost libraries? Thanks, Nate

Is there any difference between boost::type_traits::ice_and (ice_or) and boost::mpl::and_ (or_)?
boost::type_traits::ice_and takes bools, boost::mpl::and_ takes types.
Sure. But you can always call ::value on the type to get a bool, or wrap the bool in mpl::bool_<> to get a type. Does it really make sense to have two facilities that basically do the same thing? Regards, Nate

On Mon, May 14, 2012 at 8:47 AM, Nathan Ridge <zeratul976@hotmail.com>wrote:
Is there any difference between boost::type_traits::ice_and (ice_or) and boost::mpl::and_ (or_)?
boost::type_traits::ice_and takes bools, boost::mpl::and_ takes types.
Sure. But you can always call ::value on the type to get a bool, or wrap the bool in mpl::bool_<> to get a type.
Does it really make sense to have two facilities that basically do the same thing?
mpl::and_/or_ are convenient when you want/need laziness. I'd imagine you'd use ice_and/or in preference to wrapping bools with mpl::bool_ if you wanted less verbosity (and in preference to just using the standard C++ operators &&/|| if you wanted more portability?). - Jeff
participants (3)
-
Jeffrey Lee Hellrung, Jr.
-
Mathias Gaunard
-
Nathan Ridge