/* * Copyright (c) 2006, Mike Tegtmeyer * Copyright 2007, Stjepan Rajko * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the author nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #if !defined(CVALARRAY_CONSTRUCTIBLE_HPP) #if !defined(BOOST_PP_IS_ITERATING) #include #include #include #include #include #include #include #include "cvalarray.h" #define BOOST_PP_ITERATION_PARAMS_1 (3, (0,UNROLL_LIMIT, "cvalarray_constructible.hpp")) #include BOOST_PP_ITERATE() #define CVALARRAY_CONSTRUCTIBLE_HPP #else // ITERATION namespace n_std { #define CVALARRAY_N BOOST_PP_ITERATION() #if CVALARRAY_N==0 template class cvalarray_constructible #else template class cvalarray_constructible #define N CVALARRAY_N #endif : public cvalarray { public: typedef T value_type; enum {const_size = N}; cvalarray_constructible(void) {} cvalarray_constructible(const T &rhs, std::size_t n) : cvalarray(rhs, n) {} cvalarray_constructible(const T *rhs, std::size_t n) : cvalarray(rhs, n) {} cvalarray_constructible(const T (&rhs)[N]) : cvalarray(rhs) {} cvalarray_constructible(const cvalarray &rhs) : cvalarray(rhs) {} template cvalarray_constructible(const expression &rhs) : cvalarray(rhs) {} template cvalarray_constructible(const cslice_array &rhs) : cvalarray(rhs) {} template cvalarray_constructible(const cindirect_array &rhs) : cvalarray(rhs) {} #if CVALARRAY_N>0 #define CVALARRAY_ARG(z,i,s) \ typename boost::call_traits::param_type a##i #define CVALARRAY_ASSIGN(z,i,s) \ cvalarray::v[i] = a##i; //constructors with initial values cvalarray_constructible(BOOST_PP_ENUM(CVALARRAY_N,CVALARRAY_ARG,BOOST_PP_EMPTY())) { BOOST_PP_REPEAT(CVALARRAY_N, CVALARRAY_ASSIGN,BOOST_PP_EMPTY()) } #undef CVALARRAY_ARG #undef CVALARRAY_ASSIGN #endif }; #undef N } #endif // !defined(BOOST_PP_IS_ITERATING) #endif // !defined(CVALARRAY_CONSTRUCTIBLE_HPP)