#ifndef BOOST_MPL_FOLD_SEMI_LATTICE_ZERO_ONE_HPP_INCLUDED
#define BOOST_MPL_FOLD_SEMI_LATTICE_ZERO_ONE_HPP_INCLUDED

#include <boost/mpl/eval_if.hpp>
#include <boost/type_traits/is_same.hpp>

namespace boost
{
namespace mpl
{
      template
      < class Zero
      , class One
      , typename... T
      >
    struct fold_semi_lattice_zero_one
    /**@brief
     *  Fold of T... in semilattice with two elements, Zero and One
     *  where:
     *
     *    One folded with Anything == Anything.
     *    Zero folded with Anything == Zero.
     *
     */
    ;
      template
      < class Zero
      , class One
      >
    struct fold_semi_lattice_zero_one
      < Zero
      , One
      >
    : One
    {};
      template
      < class Zero
      , class One
      , typename T0
      , typename... Tn
      >
    struct fold_semi_lattice_zero_one    
      < Zero
      , One
      , T0
      , Tn...
      >
    : eval_if
      < is_same< T0, One>
      , fold_semi_lattice_zero_one<Zero,One,Tn...>
      , Zero
      >
    {};
    
}//exit mpl namespace
}//exit boost namespace
#endif
