// // Copyright (C) 2011-15 DyND Developers // BSD 2-Clause License, see LICENSE.txt // #pragma once #include #include namespace dynd { namespace nd { namespace functional { template struct apply_arg { typedef typename std::remove_cv::type>::type D; apply_arg(const ndt::type &DYND_UNUSED(tp), const char *DYND_UNUSED(arrmeta), const nd::array *DYND_UNUSED(kwds)) { } D &get(char *data) { return *reinterpret_cast(data); } }; template struct apply_arg, I> { fixed_dim value; apply_arg(const ndt::type &DYND_UNUSED(tp), const char *arrmeta, const nd::array *DYND_UNUSED(kwds)) : value(arrmeta, NULL) { } fixed_dim &get(char *data) { value.set_data(data); return value; } }; template ::type>::type::size> using as_apply_arg_sequence = typename to::type>::type, N>::type; template > struct apply_args; template struct apply_args, index_sequence> : apply_arg... { apply_args(const ndt::type *DYND_IGNORE_UNUSED(src_tp), const char *const *DYND_IGNORE_UNUSED(src_arrmeta), const nd::array *DYND_IGNORE_UNUSED(kwds)) : apply_arg(src_tp[I], src_arrmeta[I], kwds)... { } }; template struct apply_kwd { T m_val; apply_kwd(nd::array val) : m_val(val.as()) {} T get() { return m_val; } }; template > struct apply_kwds; template <> struct apply_kwds, index_sequence<>> { apply_kwds(intptr_t DYND_UNUSED(nkwd), const nd::array *DYND_UNUSED(kwds)) {} }; template struct apply_kwds, index_sequence> : apply_kwd... { apply_kwds(intptr_t DYND_UNUSED(nkwd), const nd::array *kwds) : apply_kwd(kwds[J])... {} }; template using as_apply_kwd_sequence = typename from::type>::type, N>::type; } // namespace dynd::nd::functional } // namespace dynd::nd } // namespace dynd #include #include #include #include