count_impl.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef BOOST_MPL_AUX_COUNT_IMPL_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_COUNT_IMPL_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2000-2004
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include <boost/mpl/count_fwd.hpp>
  14. #include <boost/mpl/count_if.hpp>
  15. #include <boost/mpl/same_as.hpp>
  16. #include <boost/mpl/aux_/config/static_constant.hpp>
  17. #include <boost/mpl/aux_/config/workaround.hpp>
  18. #include <boost/mpl/aux_/traits_lambda_spec.hpp>
  19. namespace boost { namespace mpl {
  20. template< typename Tag > struct count_impl
  21. {
  22. template< typename Sequence, typename T > struct apply
  23. #if BOOST_WORKAROUND(BOOST_BORLANDC,BOOST_TESTED_AT(0x561))
  24. {
  25. typedef typename count_if< Sequence,same_as<T> >::type type;
  26. BOOST_STATIC_CONSTANT(int, value = BOOST_MPL_AUX_VALUE_WKND(type)::value);
  27. #else
  28. : count_if< Sequence,same_as<T> >
  29. {
  30. #endif
  31. };
  32. };
  33. BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(2,count_impl)
  34. }}
  35. #endif // BOOST_MPL_AUX_COUNT_IMPL_HPP_INCLUDED