Ok. Better framed question.
The following is compiled on XCode 5.0.1.
Clang :
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
Boost v 1.55.0. Build 2.0-m12.
Not sure how to fix it. map complains about constructor ambiguity and I am not sure how to fix it.
I am a casual hobbyist programmer and not a C++ expert. Looking at boost headers confuses me.
Any help would be appreciated.
//---------------------------------------------------------------------
Header File
#ifndef boostTest_test_h
#define boostTest_test_h
#include <boost/multiprecision/cpp_int.hpp>
#include <map>
#include <string>
using namespace boost::multiprecision;
typedef std::map<int128_t,std::string> TestMap;
#endif
//-------------------------------------------------------------------------
C++ file
#include <iostream>
#include "test.h"
int main(int argc, const char * argv[]) {
static TestMap tm;
std::string s="hello";
int128_t n=128;
tm[n]=s; <-------------- error with 'n'
return 0;
}
//---------------------------------------
Full error blab:
In file included from /Users/tridiak/Programming/BoostTest/boostTest/boostTest/main.cpp:10:
In file included from /Users/tridiak/Programming/BoostTest/boostTest/boostTest/test.h:13:
/Applications/XC5/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:1276:29: error: call to member function '__construct_node' is ambiguous
__node_holder __h = __construct_node(__k);
^~~~~~~~~~~~~~~~
/Users/tridiak/Programming/BoostTest/boostTest/boostTest/main.cpp:16:4: note: in instantiation of member function 'std::__1::map<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<128, 128, 1, 0, void>, 0>, std::__1::basic_string<char>, std::__1::less<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<128, 128, 1, 0, void>, 0> >, std::__1::allocator<std::__1::pair<const boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<128, 128, 1, 0, void>, 0>, std::__1::basic_string<char> > > >::operator[]' requested here
tm[n]=s;
^
In file included from /Users/tridiak/Programming/BoostTest/boostTest/boostTest/main.cpp:10:
In file included from /Users/tridiak/Programming/BoostTest/boostTest/boostTest/test.h:13:
/Applications/XC5/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:993:10: note: candidate function [with _A0 = const boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<128, 128, 1, 0, void>, 0> &]
__construct_node(_A0&& __a0);
^
/Applications/XC5/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:1000:10: note: candidate function [with _A0 = const boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<128, 128, 1, 0, void>, 0> &]
__construct_node(_A0&& __a0);
^
/Applications/XC5/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:1003:23: note: candidate function template not viable: requires at least 2 arguments, but 1 was provided
__node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
^
/Applications/XC5/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:986:19: note: candidate function not viable: requires 0 arguments, but 1 was provided
__node_holder __construct_node();
^
1 error generated.