notate.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*-----------------------------------------------------------------------------+
  2. Copyright (c) 2007-2009: Joachim Faulhaber
  3. +------------------------------------------------------------------------------+
  4. Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin
  5. +------------------------------------------------------------------------------+
  6. Distributed under the Boost Software License, Version 1.0.
  7. (See accompanying file LICENCE.txt or copy at
  8. http://www.boost.org/LICENSE_1_0.txt)
  9. +-----------------------------------------------------------------------------*/
  10. /*-----------------------------------------------------------------------------
  11. Macro definitions for some useful notations e.g. iteration headers
  12. -----------------------------------------------------------------------------*/
  13. #ifndef BOOST_ICL_DETAIL_NOTATE_HPP_JOFA_990119
  14. #define BOOST_ICL_DETAIL_NOTATE_HPP_JOFA_990119
  15. // Iterations over stl or stl-compatible containers:
  16. #define ICL_FORALL(type,iter,obj) for(type::iterator iter=(obj).begin(); (iter)!=(obj).end(); (iter)++)
  17. #define ICL_const_FORALL(type,iter,obj) for(type::const_iterator iter=(obj).begin(); !((iter)==(obj).end()); (iter)++)
  18. #define ICL_FORALL_THIS(iter) for(iterator iter=begin(); (iter)!=end(); (iter)++)
  19. #define ICL_const_FORALL_THIS(iter) for(const_iterator iter=this->begin(); (iter)!=this->end(); (iter)++)
  20. // Plain old array iteration (assuming member function VecT::size()!)
  21. #define ICL_FORALL_VEC(idx, vec) for(int idx=0; idx<vec.size(); idx++)
  22. namespace boost{namespace icl
  23. {
  24. const int UNDEFINED_INDEX = -1;
  25. }} // namespace icl boost
  26. #endif // BOOST_ICL_DETAIL_NOTATE_HPP_JOFA_990119