namespace sprite { typedef boost::uint_t<32>::exact uint32; typedef boost::int_t<64>::exact int64; // Note: The constructors for a given type are numbered CTOR, CTOR+1, ... enum Tag { FAIL= -4, FWD= -3, CHOICE= -2, OPER= -1, CTOR=0 }; typedef signed char tag_type; typedef uint32 refcnt_type; typedef unsigned char mark_type; struct RuntimeError : std::exception { RuntimeError(std::string const & msg = std::string()) : m_msg("Runtime error: " + msg) {} virtual char const * what() const throw() { return m_msg.c_str(); } virtual ~RuntimeError() throw() {} private: std::string m_msg; }; // Indicates an eager evaluation produced a failure. struct ComputationFailed {}; // The node requires space for 2 pointers (vptr + tag fields) plus // extra to hold the children. The extra space must be at least one // pointer (to hold a pointer to the list of children), and must be // large enough to hold all of the inplace children. size_t const NODE_BYTES = (2 + BOOST_PP_MAX(BOOST_PP_DEC(SPRITE_INPLACE_BOUND), 1)) * sizeof(void *); }
template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> struct is_applyable<R(BOOST_PP_ENUM_PARAMS(N, A))> : mpl::true_ {}; template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> struct is_applyable<R(*)(BOOST_PP_ENUM_PARAMS(N, A))> : mpl::true_ {}; template<typename T, typename A> struct construct_<proto::expr<T, A, N>, true> { typedef proto::expr<T, A, N> result_type; template<BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), typename A)> BOOST_FORCEINLINE result_type operator ()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_MAX(N, 1), A, &a)) const { return result_type::make(BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), a)); } }; template<typename T, typename A> struct construct_<proto::basic_expr<T, A, N>, true> { typedef proto::basic_expr<T, A, N> result_type; template<BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), typename A)> BOOST_FORCEINLINE result_type operator ()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_MAX(N, 1), A, &a)) const