
#if !BOOST_PP_IS_ITERATING

	#ifndef BOOST_NEW_HPP
	#define BOOST_NEW_HPP "new.hpp"

	#include <boost/preprocessor/cat.hpp>
	#include <boost/preprocessor/iteration/iterate.hpp>
	#include <boost/preprocessor/punctuation/comma_if.hpp>
	#include <boost/preprocessor/repetition/enum_params.hpp>
	#include <boost/preprocessor/repetition/repeat.hpp>
	#include <boost/preprocessor/seq/for_each_i.hpp>
	#include <boost/preprocessor/seq/for_each_product.hpp>
	#include <boost/preprocessor/seq/size.hpp>

	#include <memory>

	namespace boost {

		template<class T> inline std::auto_ptr<T> new_(void) {
			return std::auto_ptr<T>(new T);
		}

		#ifndef BOOST_NEW_MAX_ARITY
			#define BOOST_NEW_MAX_ARITY 5
		#endif

		#define m1(z, n, _) ((0)(1))
		#define m2(r, product) m3(r, BOOST_PP_SEQ_SIZE(product), product)
		#define m3(r, size, product) \
			template<class T, BOOST_PP_ENUM_PARAMS(size, class A)> \
			inline std::auto_ptr<T> new_(BOOST_PP_SEQ_FOR_EACH_I_R(r, m4, ~, product)) { \
				return std::auto_ptr<T>(new T(BOOST_PP_ENUM_PARAMS(size, x))); \
			} \
			/**/
		#define m4(r, _, i, elem) \
			BOOST_PP_COMMA_IF(i) BOOST_PP_CAT(c, elem) BOOST_PP_CAT(A, i)& BOOST_PP_CAT(x, i) \
			/**/

		#define c0
		#define c1 const

		#define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_NEW_MAX_ARITY, BOOST_NEW_HPP))
		#include BOOST_PP_ITERATE()

		#undef c0
		#undef c1

		#undef m1
		#undef m2
		#undef m3
		#undef m4

	} // boost

	#endif // BOOST_NEW_HPP

#else

	BOOST_PP_SEQ_FOR_EACH_PRODUCT(
		m2,
		BOOST_PP_REPEAT(BOOST_PP_ITERATION(), m1, ~)
	)

#endif

