"tests/kernels/test_pos_encoding.py" did not exist on "897cb2ae28e93de1b22ecfbffcccfb9493f8f4d9"
convert.cpp 1.33 KB
Newer Older
1
#include "yaml-cpp/value/convert.h"
2
3
4

namespace YAML
{
Jesse Beder's avatar
Jesse Beder committed
5

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//#define YAML_DEFINE_CONVERT_STREAMABLE(type)\
//	template<> Value convert(const type& rhs) {\
//		std::stringstream stream;\
//		stream << rhs;\
//		return Value(stream.str());\
//	}\
//	template<> bool convert(const Value& value, type& rhs) {\
//		if(value.Type() != ValueType::Scalar)\
//			return false;\
//		std::stringstream stream(value.scalar());\
//		stream >> rhs;\
//		return !!stream;\
//	}
//
//	YAML_DEFINE_CONVERT_STREAMABLE(int)
//	YAML_DEFINE_CONVERT_STREAMABLE(unsigned)
//	YAML_DEFINE_CONVERT_STREAMABLE(short)
//	YAML_DEFINE_CONVERT_STREAMABLE(unsigned short)
//	YAML_DEFINE_CONVERT_STREAMABLE(long)
//	YAML_DEFINE_CONVERT_STREAMABLE(unsigned long)
//	YAML_DEFINE_CONVERT_STREAMABLE(long long)
//	YAML_DEFINE_CONVERT_STREAMABLE(unsigned long long)
//
//	YAML_DEFINE_CONVERT_STREAMABLE(char)
//	YAML_DEFINE_CONVERT_STREAMABLE(unsigned char)
//
//	YAML_DEFINE_CONVERT_STREAMABLE(float)
//	YAML_DEFINE_CONVERT_STREAMABLE(double)
//	YAML_DEFINE_CONVERT_STREAMABLE(long double)
//	
//#undef YAML_DEFINE_CONVERT_STREAMABLE
//	
//	template<typename K, typename V>
//	Value convert<std::map<K, V> >(const std::map<K, V>& rhs) {
//		Value value(ValueType::Map);
//		for(std::map<K, V>::const_iterator it=rhs.begin();it!=rhs.end();++it)
//			value[it->first] = it->second;
//		return value;
//	}
45
}