MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / toDouble

Method toDouble

Core/Utilities/Tools/QString.cpp:186–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186double QString::toDouble(bool *ok) const
187{
188 double value = 0.0;
189 bool flag = false;
190 try
191 {
192 value = std::stod(m_data);
193 flag = true;
194 }
195 catch (const std::invalid_argument& ia)
196 {
197 std::cout << "Invalid argument: " << ia.what() << std::endl;
198 flag = false;
199 }
200 catch (const std::out_of_range& oor) {
201 std::cout << "Out of Range error: " << oor.what() << std::endl;
202 flag = false;
203 }
204
205 if (ok)
206 {
207 *ok = flag;
208 }
209
210 return value;
211}
212

Callers 3

restoreParaFromCacheMethod · 0.80
restoreParaFromCacheMethod · 0.80
restoreParaFromCacheMethod · 0.80

Calls 1

whatMethod · 0.45

Tested by

no test coverage detected