//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*- // file movecopy.cpp #include "movecopy.hpp" namespace movecopy { template <> size_t copy(const double &from, double *to, const size_t &n) { size_t i; size_t nReturnValue = 0L; if(to) { for (i = 0; i < n; i++) to[ i ] = from; nReturnValue = n; } return nReturnValue; } template <> size_t copy(const int &from, int *to, const size_t &n) { size_t i; size_t nReturnValue = 0L; if(to) { for (i = 0; i < n; i++) to[ i ] = from; nReturnValue = n; } return nReturnValue; } template <> size_t copy(const long int &from, long int *to, const size_t &n) { size_t i; size_t nReturnValue = 0L; if(to) { for (i = 0; i < n; i++) to[ i ] = from; nReturnValue = n; } return nReturnValue; } template <> size_t copy(const size_t &from, size_t *to, const size_t &n) { size_t i; size_t nReturnValue = 0L; if(to) { for (i = 0; i < n; i++) to[ i ] = from; nReturnValue = n; } return nReturnValue; } template <> size_t copy(const std::string &from, std::string *to, const size_t &n) { size_t i; size_t nReturnValue = 0; if (to) { for (i = 0; i < n; i++) to[ i ] = from; nReturnValue = n; } return nReturnValue; } template <> size_t copy(const double &from, std::vector &to, const size_t &n) { size_t i; size_t nReturnValue = 0L; if(to.size() >= n) { for(i = 0; i < n; i++) to[ i ] = from; nReturnValue = n; } return nReturnValue; } template <> size_t copy(const int &from, std::vector &to, const size_t &n) { size_t i; size_t nReturnValue = 0L; if(to.size() >= n) { for(i = 0; i < n; i++) to[ i ] = from; nReturnValue = n; } return nReturnValue; } template <> size_t copy(const long int &from, std::vector &to, const size_t &n) { size_t i; size_t nReturnValue = 0L; if(to.size() >= n) { for(i = 0; i < n; i++) to[ i ] = from; nReturnValue = n; } return nReturnValue; } template <> size_t copy(const size_t &from, std::vector &to, const size_t &n) { size_t i; size_t nReturnValue = 0L; if(to.size() >= n) { for(i = 0; i < n; i++) to[ i ] = from; nReturnValue = n; } return nReturnValue; } template <> size_t copy(const std::string &from, std::vector &to, const size_t &n) { size_t i; size_t nReturnValue = 0; // if(to.size() >= n) { for(i = 0; i < n; i++) to[ i ] = from; nReturnValue = n; } return nReturnValue; } template <> size_t move(const double from[], double *to, const size_t &n) { size_t i; size_t nReturnValue = 0; if (from) { if (to) { for (i = 0; i < n; i++) to[ i ] = from[ i ]; nReturnValue = n; } } return nReturnValue; } template <> size_t move(const int from[], int *to, const size_t &n) { size_t i; size_t nReturnValue = 0; if (from) { if (to) { for (i = 0; i < n; i++) to[ i ] = from[ i ]; nReturnValue = n; } } return nReturnValue; } template <> size_t move(const long int from[], long int *to, const size_t &n) { size_t i; size_t nReturnValue = 0; if (from) { if (to) { for (i = 0; i < n; i++) to[ i ] = from[ i ]; nReturnValue = n; } } return nReturnValue; } template <> size_t move(const std::string from[], std::string *to, const size_t &n) { size_t i; size_t nReturnValue = 0; if (from) { if (to) { for (i = 0; i < n; i++) to[ i ] = from[ i ]; nReturnValue = n; } } return nReturnValue; } template <> size_t move0(double *to, const size_t &n) { return copy(0.0, to, n); } template <> size_t move0(int *to, const size_t &n) { return copy((int) 0, to, n); } template <> size_t move0(long int *to, const size_t &n) { return copy((long int) 0, to, n); } template <> size_t move0(size_t *to, const size_t &n) { return copy((size_t) 0, to, n); } template <> size_t move(const std::vector &from, std::vector &to, const size_t &n) { size_t i; size_t nReturnValue = 0; // if(from.size() == to.size()) { for(i = 0; i < n; i++) to[ i ] = from[ i ]; nReturnValue = n; } return nReturnValue; } template <> size_t move(const std::vector &from, std::vector &to, const size_t &n) { size_t i; size_t nReturnValue = 0; // if(from.size() == to.size()) { for(i = 0; i < n; i++) to[ i ] = from[ i ]; nReturnValue = n; } return nReturnValue; } template <> size_t move(const std::vector &from, std::vector &to, const size_t &n) { size_t i; size_t nReturnValue = 0; // if(from.size() == to.size()) { for(i = 0; i < n; i++) to[ i ] = from[ i ]; nReturnValue = n; } return nReturnValue; } template <> size_t move(const std::vector &from, std::vector &to, const size_t &n) { size_t i; size_t nReturnValue = 0; // if(from.size() == to.size()) { for(i = 0; i < n; i++) to[ i ] = from[ i ]; nReturnValue = n; } return nReturnValue; } template <> size_t move(const std::vector &from, std::vector &to, const size_t &n) { size_t i; size_t nReturnValue = 0; // if(from.size() == to.size()) { for(i = 0; i < n; i++) to[ i ] = from[ i ]; nReturnValue = n; } return nReturnValue; } template <> size_t move0(std::vector &to, const size_t &n) { return copy(0.0, to, n); } template <> size_t move0(std::vector &to, const size_t &n) { return copy((int) 0, to, n); } template <> size_t move0(std::vector &to, const size_t &n) { return copy((long int) 0, to, n); } template <> size_t move0(std::vector &to, const size_t &n) { return copy((size_t) 0, to, n); } } // end of file movecopy.cpp