mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-04-11 03:20:46 +01:00
strTo<> now converts string of numbers to vector<Index>
This commit is contained in:
parent
28aff209c4
commit
15a5471bef
@ -108,6 +108,23 @@ inline std::string strFrom(const T x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// specialization for vectors
|
// specialization for vectors
|
||||||
|
template<>
|
||||||
|
inline std::vector<Index> strTo<std::vector<Index>>(const std::string &str)
|
||||||
|
{
|
||||||
|
std::vector<Index> res;
|
||||||
|
std::vector<double> vbuf;
|
||||||
|
double buf;
|
||||||
|
std::istringstream stream(str);
|
||||||
|
|
||||||
|
while (!stream.eof())
|
||||||
|
{
|
||||||
|
stream >> buf;
|
||||||
|
vbuf.push_back(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline DVec strTo<DVec>(const std::string &str)
|
inline DVec strTo<DVec>(const std::string &str)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user