//Date:
//  2010-09-04
//Purpose:
//  Provide *maybe* a use-case for using:
//
//    http://bitbucket.org/camior/de-bruijn-bind/src
//
#include <boost/mpl/int.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/apply.hpp>

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

using namespace boost;
using namespace mpl;
using namespace placeholders;

namespace test
{

    typedef 
  next< _1>
op
;
    typedef
  int_<2>
apply_expected
;
#if 1
      typedef
    apply
    < apply
      < op
      , _1
      >
    , int_<1>
    >::type
  apply_apply
  //This fails to compile.
  ;
  //BOOST_MPL_ASSERT(( is_same<apply_apply, apply_expected > ));
#endif  
#if 1
      typedef
    apply
    < apply_wrap1
      < lambda<op>::type
      , _1
      >
    , int_<1>
    >::type
  apply_wrap_lambda
  //This compiles and passes following test.
  ;
  BOOST_MPL_ASSERT(( is_same<apply_wrap_lambda, apply_expected > ));
#endif
}//exit test_io namespace
