Files
boost_preprocessor/include/boost/preprocessor/seq/fold_left.hpp

74 lines
3.2 KiB
C++
Raw Normal View History

2002-11-07 23:16:43 +00:00
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002.
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
2002-11-07 23:16:43 +00:00
# * *
# ************************************************************************** */
#
# /* Revised by Edward Diener (2020) */
#
2002-11-07 23:16:43 +00:00
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_SEQ_FOLD_LEFT_HPP
# define BOOST_PREPROCESSOR_SEQ_FOLD_LEFT_HPP
#
2020-07-02 11:24:15 -04:00
# include <boost/preprocessor/arithmetic/dec.hpp>
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/control/if.hpp>
# include <boost/preprocessor/debug/error.hpp>
# include <boost/preprocessor/detail/auto_rec.hpp>
# include <boost/preprocessor/seq/seq.hpp>
# include <boost/preprocessor/seq/size.hpp>
#
# /* BOOST_PP_SEQ_FOLD_LEFT */
#
# if 0
# define BOOST_PP_SEQ_FOLD_LEFT(op, state, seq) ...
# endif
#
# include <boost/preprocessor/config/limits.hpp>
2002-11-07 23:16:43 +00:00
#
# if BOOST_PP_LIMIT_SEQ == 256
# define BOOST_PP_SEQ_FOLD_LEFT BOOST_PP_CAT(BOOST_PP_SEQ_FOLD_LEFT_, BOOST_PP_DEC(BOOST_PP_AUTO_REC(BOOST_PP_SEQ_FOLD_LEFT_P, 256)))
# elif BOOST_PP_LIMIT_SEQ == 512
# define BOOST_PP_SEQ_FOLD_LEFT BOOST_PP_CAT(BOOST_PP_SEQ_FOLD_LEFT_, BOOST_PP_DEC(BOOST_PP_AUTO_REC(BOOST_PP_SEQ_FOLD_LEFT_P, 512)))
# elif BOOST_PP_LIMIT_SEQ == 1024
# define BOOST_PP_SEQ_FOLD_LEFT BOOST_PP_CAT(BOOST_PP_SEQ_FOLD_LEFT_, BOOST_PP_DEC(BOOST_PP_AUTO_REC(BOOST_PP_SEQ_FOLD_LEFT_P, 1024)))
2004-10-24 23:52:55 +00:00
# else
# error Incorrect value for the BOOST_PP_LIMIT_SEQ limit
2004-10-24 23:52:55 +00:00
# endif
2002-11-07 23:16:43 +00:00
#
# define BOOST_PP_SEQ_FOLD_LEFT_P(n) BOOST_PP_SEQ_FOLD_LEFT_P_DEC(BOOST_PP_DEC(n))
# define BOOST_PP_SEQ_FOLD_LEFT_P_DEC(n) BOOST_PP_CAT(BOOST_PP_SEQ_FOLD_LEFT_CHECK_, BOOST_PP_CAT(BOOST_PP_SEQ_FOLD_LEFT_I_,n)(BOOST_PP_SEQ_FOLD_LEFT_O, BOOST_PP_NIL, (nil), 1))
2020-07-02 11:24:15 -04:00
# define BOOST_PP_SEQ_FOLD_LEFT_O(s, st, _) st
#
# if BOOST_PP_LIMIT_SEQ == 256
# define BOOST_PP_SEQ_FOLD_LEFT_257(op, st, ss) BOOST_PP_ERROR(0x0005)
# define BOOST_PP_SEQ_FOLD_LEFT_I_257(op, st, ss, sz) BOOST_PP_ERROR(0x0005)
# elif BOOST_PP_LIMIT_SEQ == 512
# define BOOST_PP_SEQ_FOLD_LEFT_513(op, st, ss) BOOST_PP_ERROR(0x0005)
# define BOOST_PP_SEQ_FOLD_LEFT_I_513(op, st, ss, sz) BOOST_PP_ERROR(0x0005)
2020-08-11 22:13:23 -04:00
# elif BOOST_PP_LIMIT_SEQ == 1024
# define BOOST_PP_SEQ_FOLD_LEFT_1025(op, st, ss) BOOST_PP_ERROR(0x0005)
# define BOOST_PP_SEQ_FOLD_LEFT_I_1025(op, st, ss, sz) BOOST_PP_ERROR(0x0005)
2020-07-02 11:24:15 -04:00
# endif
#
# define BOOST_PP_SEQ_FOLD_LEFT_CHECK_BOOST_PP_NIL 1
#
# define BOOST_PP_SEQ_FOLD_LEFT_F(op, st, ss, sz) st
#
# if BOOST_PP_LIMIT_SEQ == 256
# include <boost/preprocessor/seq/limits/fold_left_256.hpp>
# elif BOOST_PP_LIMIT_SEQ == 512
# include <boost/preprocessor/seq/limits/fold_left_256.hpp>
# include <boost/preprocessor/seq/limits/fold_left_512.hpp>
# elif BOOST_PP_LIMIT_SEQ == 1024
# include <boost/preprocessor/seq/limits/fold_left_256.hpp>
# include <boost/preprocessor/seq/limits/fold_left_512.hpp>
# include <boost/preprocessor/seq/limits/fold_left_1024.hpp>
2020-07-02 11:24:15 -04:00
# endif
#
2002-11-07 23:16:43 +00:00
# endif