Code: Select all
#include <iostream>
#include <util\MultiType.h>
int main()
{
orxonox::MultiType a = 42;
std::string test;
a.getValue<std::string>(&test);
std::cout << test;
}
Code: Select all
#include <iostream>
#include <util\MultiType.h>
int main()
{
orxonox::MultiType a = 42;
std::string test = a.get<std::string>();
std::cout << test;
}
When I just do1>[long path]\orxonox\src\libraries\util\multitype.h(380): error C2668: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string' : ambiguous call to overloaded function
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring(949): could be 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::initializer_list<_Elem>,const std::allocator<char> &)'
1> with
1> [
1> _Elem=char
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring(885): or 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::basic_string<char,std::char_traits<char>,std::allocator<char>> &&) throw()'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring(778): or 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Elem *)'
1> with
1> [
1> _Elem=char
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\xstring(719): or 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &)'
1> while trying to match the argument list '(const orxonox::MultiType)'
1> [long path]\multitype test\main.cpp(9) : see reference to function template instantiation 'T orxonox::MultiType::get<std::string>(void) const' being compiled
1> with
1> [
1> T=std::string
1> ]
Code: Select all
std::string test = a;
Not really high priority, but it would be nice if there would be a quick fix for this.error C2440: 'initializing' : cannot convert from 'orxonox::MultiType' to 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
1> No constructor could take the source type, or constructor overload resolution was ambiguous