39 template <
typename S,
typename T>
41 fill(std::vector<S>& outArray,
const std::vector<T>& inArray,
size_t first,
size_t last)
44 int range = last - first + 1;
45 if (outArray.size() !=
static_cast<size_t>(range)) outArray.resize(range);
46 for (
size_t j = first - 1; j < last; ++j)
48 outArray[j - first + 1] =
static_cast<S
>(inArray[j]);
54 template <
typename S,
typename T>
55 void fill(std::valarray<S>& outArray,
const std::vector<T>& inArray,
size_t first,
size_t last)
58 int range = last - first + 1;
59 if (outArray.size() !=
static_cast<size_t>(range)) outArray.resize(range);
60 for (
size_t j = first - 1; j < last; ++j)
62 outArray[j - first + 1] =
static_cast<S
>(inArray[j]);
68 template <
typename S,
typename T>
69 void fill(std::valarray<S>& outArray,
const std::valarray<T>& inArray)
71 size_t n = inArray.size();
72 if (outArray.size() != n) outArray.resize(n);
73 for (
size_t j = 0;j < n; ++j) outArray[j]
74 = static_cast<S>(inArray[j]);
77 #ifdef TEMPLATE_AMBIG7_DEFECT 78 template <
typename S,
typename T>
79 void fillMSva(std::vector<S>& outArray,
const std::valarray<T>& inArray)
81 size_t n = inArray.size();
82 if (outArray.size() != n) outArray.resize(n);
83 for (
size_t j = 0;j < n; ++j) outArray[j]
84 = static_cast<S>(inArray[j]);
88 template <
typename S,
typename T>
89 void fill(std::vector<S>& outArray,
const std::valarray<T>& inArray)
91 size_t n = inArray.size();
92 if (outArray.size() != n) outArray.resize(n);
93 for (
size_t j = 0;j < n; ++j) outArray[j]
94 = static_cast<S>(inArray[j]);
101 template <
typename T>
103 fill(std::vector<string>& outArray,
const std::vector<T>& inArray,
size_t first,
size_t last)
107 throw InvalidConversion(errorMessage(outArray,inArray),
false);
111 template <
typename T>
112 void fill(std::vector<T>& outArray,
const std::vector<string>& inArray,
size_t first,
size_t last)
116 throw InvalidConversion(errorMessage(outArray,inArray),
false);
122 template<
typename S,
typename T>
123 string errorMessage(
const S& out,
const T& in)
125 #ifdef SSTREAM_DEFECT 126 std::ostrstream errMsg;
128 std::ostringstream errMsg;
130 errMsg <<
" Error: no conversion from " <<
typeid(in).name() <<
" to " 131 <<
typeid(out).name() << std::endl;
FITSUtil is a namespace containing functions used internally by CCfits, but which might be of use for...
Namespace enclosing all CCfits classes and globals definitions.
Definition: AsciiTable.cxx:26