Files
yaml-cpp/include/conversion.h
T

31 lines
738 B
C++
Raw Normal View History

#pragma once
2009-07-29 22:27:20 +00:00
#ifndef CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#include "null.h"
#include "traits.h"
#include <string>
#include <sstream>
namespace YAML
{
inline bool Convert(const std::string& input, std::string& output) {
output = input;
return true;
}
2009-07-15 20:47:51 +00:00
bool Convert(const std::string& input, bool& output);
bool Convert(const std::string& input, _Null& output);
2009-11-10 21:23:52 +00:00
template <typename T>
inline bool Convert(const std::string& input, T& output, typename enable_if<is_numeric<T> >::type * = 0) {
2009-11-10 21:23:52 +00:00
std::stringstream stream(input);
stream.unsetf(std::ios::dec);
return stream >> output;
}
}
2009-07-29 22:27:20 +00:00
#endif // CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66