Skip to content

Commit 8be9d53

Browse files
committed
Clang fix again
1 parent 4ce0d89 commit 8be9d53

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/Core/Utils/StringUtil.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
#include <boost/atomic.hpp>
4040
#include <Core/Utils/share.h>
4141

42-
namespace SCIRun
42+
namespace SCIRun
4343
{
4444
namespace Core
4545
{
46-
46+
4747
template <typename T>
4848
std::vector<T*> toVectorOfRawPointers(const std::vector<boost::shared_ptr<T>>& vec)
4949
{
@@ -52,7 +52,7 @@ std::vector<T*> toVectorOfRawPointers(const std::vector<boost::shared_ptr<T>>& v
5252
std::transform(vec.begin(), vec.end(), std::back_inserter(raws), [](boost::shared_ptr<T> ptr) { return ptr.get(); });
5353
return raws;
5454
}
55-
55+
5656
template <typename T>
5757
std::string to_string(const T& t)
5858
{
@@ -66,7 +66,7 @@ std::vector<T> parseLineOfNumbers(const std::string& line)
6666
{
6767
std::istringstream stream(line);
6868
std::vector<T> numbers((std::istream_iterator<T>(stream)), (std::istream_iterator<T>()));
69-
69+
7070
return numbers;
7171
}
7272

@@ -93,7 +93,7 @@ std::vector<boost::shared_ptr<T>> upcast_range(Iter begin, Iter end)
9393
return std::move(output);
9494
}
9595

96-
template <class T, class Cont>
96+
template <class T, class Cont>
9797
std::vector<boost::shared_ptr<T>> upcast_range(const Cont& container)
9898
{
9999
return upcast_range<T>(container.begin(), container.end());
@@ -108,19 +108,35 @@ struct SCISHARE AtomicCounter
108108

109109
SCISHARE bool replaceSubstring(std::string& str, const std::string& from, const std::string& to);
110110

111+
template <class T>
112+
bool from_string(const std::string &str, T &value)
113+
{
114+
std::istringstream iss(str+" ");
115+
iss.exceptions(std::ifstream::eofbit | std::ifstream::failbit | std::ifstream::badbit);
116+
try
117+
{
118+
iss >> value;
119+
return (true);
120+
}
121+
catch (...)
122+
{
123+
return (false);
124+
}
125+
}
126+
111127
//TODO: replace with boost::regex
112128
template <class T>
113129
bool multiple_from_string(const std::string &str, std::vector<T> &values)
114130
{
115131
values.clear();
116132

117133
std::string data = str;
118-
for (size_t j=0; j<data.size(); j++)
134+
for (size_t j=0; j<data.size(); j++)
119135
if ((data[j] == '\t')||(data[j] == '\r')||(data[j] == '\n')||(data[j]=='"')) data[j] = ' ';
120136

121137
std::vector<std::string> nums;
122138
for (size_t p=0;p<data.size();)
123-
{
139+
{
124140
while((data[p] == ' ')&&(p<data.size())) p++;
125141
if (p >= data.size()) break;
126142

@@ -136,22 +152,6 @@ bool multiple_from_string(const std::string &str, std::vector<T> &values)
136152
return (false);
137153
}
138154

139-
template <class T>
140-
bool from_string(const std::string &str, T &value)
141-
{
142-
std::istringstream iss(str+" ");
143-
iss.exceptions(std::ifstream::eofbit | std::ifstream::failbit | std::ifstream::badbit);
144-
try
145-
{
146-
iss >> value;
147-
return (true);
148-
}
149-
catch (...)
150-
{
151-
return (false);
152-
}
153-
}
154-
155155
}}
156156

157157
namespace std

0 commit comments

Comments
 (0)