this_count.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (C) 2009-2012 Lorenzo Caminiti
  2. // Distributed under the Boost Software License, Version 1.0
  3. // (see accompanying file LICENSE_1_0.txt or a copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Home at http://www.boost.org/libs/local_function
  6. #ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_THIS_COUNT_HPP_
  7. #define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_THIS_COUNT_HPP_
  8. #include <boost/local_function/aux_/preprocessor/traits/decl_/set_error.hpp>
  9. #include <boost/local_function/aux_/preprocessor/traits/decl_const_binds.hpp>
  10. #include <boost/local_function/aux_/preprocessor/traits/decl_binds.hpp>
  11. #include <boost/preprocessor/control/iif.hpp>
  12. #include <boost/preprocessor/facilities/empty.hpp>
  13. #include <boost/preprocessor/tuple/eat.hpp>
  14. #include <boost/preprocessor/comparison/greater.hpp>
  15. #include <boost/preprocessor/list/append.hpp>
  16. #include <boost/preprocessor/list/size.hpp>
  17. // PUBLIC //
  18. #define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_THIS_COUNT( \
  19. decl_traits) \
  20. BOOST_PP_IIF(BOOST_PP_GREATER(BOOST_PP_LIST_SIZE(BOOST_PP_LIST_APPEND( \
  21. BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_THIS_TYPES( \
  22. decl_traits), \
  23. BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_THIS_TYPES( \
  24. decl_traits))), \
  25. 1), \
  26. BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SET_ERROR \
  27. , /* do nothing (keeping previous error, if any) */ \
  28. decl_traits BOOST_PP_TUPLE_EAT(2) \
  29. )(decl_traits, /* trailing `EMPTY` because error might not be present */ \
  30. ERROR_cannot_bind_object_this_multiple_times BOOST_PP_EMPTY)
  31. #endif // #include guard