// @HEADER // ***************************************************************************** // Sacado Package // // Copyright 2006 NTESS and the Sacado contributors. // SPDX-License-Identifier: LGPL-2.1-or-later // ***************************************************************************** // @HEADER #ifndef SACADO_MPL_RANGE_C_HPP #define SACADO_MPL_RANGE_C_HPP #include "Sacado_mpl_none.hpp" #include "Sacado_mpl_size.hpp" #include "Sacado_mpl_begin.hpp" #include "Sacado_mpl_end.hpp" #include "Sacado_mpl_next.hpp" #include "Sacado_mpl_at.hpp" #include "Sacado_mpl_deref.hpp" #include "Sacado_mpl_integral_c.hpp" namespace Sacado { namespace mpl { // range_c tag for mpl operations struct range_c_tag {}; // range_c template struct range_c { typedef range_c_tag tag; typedef range_c type; static const int sz = (M-N+Delta-1)/Delta; typedef T integral_type; static const int start_value = N; static const int end_value = M; static const int step_value = Delta; }; // iterator template struct range_c_iterator { static const int value = Pos; }; // size template <> struct size_impl { template struct apply { static const int value = Range::sz; }; }; // begin template <> struct begin_impl { template struct apply { typedef range_c_iterator type; }; }; // end template <> struct end_impl { template struct apply { typedef range_c_iterator type; }; }; // next template struct next< range_c_iterator > { typedef range_c_iterator type; }; // at template struct at_impl { template struct apply { typedef integral_c type; }; }; // deref template struct deref< range_c_iterator > : mpl::at {}; } } #endif