conversion.h 750 Bytes
Newer Older
1
2
#pragma once

3
4
5
6
#ifndef CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66


7
#include "null.h"
8
#include "traits.h"
9
10
11
12
13
#include <string>
#include <sstream>

namespace YAML
{
14
	inline bool Convert(const std::string& input, std::string& output) {
15
16
17
		output = input;
		return true;
	}
18
	
19
20
21
	bool Convert(const std::string& input, bool& output);
	bool Convert(const std::string& input, _Null& output);
	
22
	template <typename T> 
23
	inline bool Convert(const std::string& input, T& output, typename enable_if<is_numeric<T> >::type * = 0) {
24
25
		std::stringstream stream(input);
		stream.unsetf(std::ios::dec);
26
27
		stream >> output;
		return !!stream;
28
	}
29
}
30
31

#endif // CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66