PageRenderTime 26ms CodeModel.GetById 19ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/Src/Dependencies/Boost/boost/mpl/switch.hpp

http://hadesmem.googlecode.com/
C++ Header | 49 lines | 28 code | 11 blank | 10 comment | 0 complexity | 5a1343410d5380f1b7ca3e6531b07123 MD5 | raw file
 1
 2#ifndef BOOST_MPL_SWITCH_HPP_INCLUDED
 3#define BOOST_MPL_SWITCH_HPP_INCLUDED
 4
 5// Copyright Aleksey Gurtovoy 2003-2004
 6//
 7// Distributed under the Boost Software License, Version 1.0. 
 8// (See accompanying file LICENSE_1_0.txt or copy at 
 9// http://www.boost.org/LICENSE_1_0.txt)
10//
11// See http://www.boost.org/libs/mpl for documentation.
12
13// $Id: switch.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
14// $Date: 2008-10-11 17:19:02 +1100 (Sat, 11 Oct 2008) $
15// $Revision: 49267 $
16
17#include <boost/mpl/find_if.hpp>
18#include <boost/mpl/deref.hpp>
19#include <boost/mpl/lambda.hpp>
20#include <boost/mpl/apply.hpp>
21#include <boost/mpl/pair.hpp>
22#include <boost/mpl/aux_/na_spec.hpp>
23#include <boost/mpl/aux_/lambda_support.hpp>
24
25namespace boost { namespace mpl {
26
27template< 
28      typename BOOST_MPL_AUX_NA_PARAM(Body)
29    , typename BOOST_MPL_AUX_NA_PARAM(T)
30    >
31struct switch_
32{
33    typedef typename find_if<
34          Body
35        , apply1< lambda< first<_1> >, T >
36        >::type iter_;
37        
38    typedef typename deref<iter_>::type pair_;
39    typedef typename lambda< typename second<pair_>::type >::type f_;
40    typedef typename apply1<f_,T>::type type;
41
42    BOOST_MPL_AUX_LAMBDA_SUPPORT(2,switch_,(Body,T))
43};
44
45BOOST_MPL_AUX_NA_SPEC(2, switch_)
46
47}}
48
49#endif // BOOST_MPL_SWITCH_HPP_INCLUDED