Nomango/configor

不能正确解析integer

Closed this issue · 3 comments

std::string的data()内容如下:
{
"code": 0,
"session": "sIMIG9Fe"
}
抛出一下错误:
terminate called after throwing an instance of 'configor::configor_type_error'
what(): config type error: cannot convert type 'string' to type 'integer' (implicitly)

试着static-cast成string,又抛“不能把integer转换为string”了

@ntzxtyz 不是bug,是使用方式有问题,可以阅读一下readme中的取值方式部分

不能使用static_cast转换是因为类型本身就不可以转换,比如下面的代码本身就是错误的

int i = 10;
std::string str = static_cast<std::string>(i);