1 | |

2 | __#ifndef BOOST_MPL_COUNT_IF_HPP_INCLUDED__ |

3 | __#define BOOST_MPL_COUNT_IF_HPP_INCLUDED__ |

4 | |

5 | *// Copyright Aleksey Gurtovoy 2000-2002* |

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$* |

14 | *// $Date$* |

15 | *// $Revision$* |

16 | |

17 | __#include <boost/mpl/fold.hpp>__ |

18 | __#include <boost/mpl/next.hpp>__ |

19 | __#include <boost/mpl/integral_c.hpp>__ |

20 | __#include <boost/mpl/identity.hpp>__ |

21 | __#include <boost/mpl/eval_if.hpp>__ |

22 | __#include <boost/mpl/apply.hpp>__ |

23 | __#include <boost/mpl/aux_/msvc_eti_base.hpp>__ |

24 | __#include <boost/mpl/aux_/na_spec.hpp>__ |

25 | __#include <boost/mpl/aux_/lambda_support.hpp>__ |

26 | __#include <boost/mpl/aux_/config/forwarding.hpp>__ |

27 | |

28 | **namespace** boost { **namespace** mpl { |

29 | |

30 | **namespace** aux { |

31 | |

32 | **template**< **typename** Predicate > |

33 | **struct** next_if |

34 | { |

35 | **template**< |

36 | **typename** N |

37 | , **typename** T |

38 | > |

39 | **struct** apply |

40 | __#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)__ |

41 | : eval_if< |

42 | **typename** apply1<Predicate,T>::type |

43 | , next<N> |

44 | , identity<N> |

45 | > |

46 | { |

47 | __#else__ |

48 | { |

49 | **typedef** **typename** eval_if< |

50 | **typename** apply1<Predicate,T>::type |

51 | , next<N> |

52 | , identity<N> |

53 | >::type type; |

54 | __#endif__ |

55 | }; |

56 | }; |

57 | |

58 | } *// namespace aux* |

59 | |

60 | |

61 | **template**< |

62 | **typename** BOOST_MPL_AUX_NA_PARAM(Sequence) |

63 | , **typename** BOOST_MPL_AUX_NA_PARAM(Predicate) |

64 | > |

65 | **struct** count_if |

66 | : aux::msvc_eti_base< **typename** fold< |

67 | Sequence |

68 | , integral_c<*unsigned* *long*,`0`> |

69 | , protect< aux::next_if<Predicate> > |

70 | >::type > |

71 | { |

72 | BOOST_MPL_AUX_LAMBDA_SUPPORT(`2`,count_if,(Sequence,Predicate)) |

73 | }; |

74 | |

75 | BOOST_MPL_AUX_NA_SPEC(`2`, count_if) |

76 | |

77 | }} |

78 | |

79 | __#endif // BOOST_MPL_COUNT_IF_HPP_INCLUDED__ |

80 | |