0

I'm using the BigInteger library. However when converting from string to BigInteger I summon the error "no matching function for call BigInteger(string&)".

How should one convert from between the two without invoking an error?

Here is a snippit of my code:

      #include "BigIntegerLibrary.hh"

      str1=randomStrGen(1);
      str2=randomStrGen(1);

      BigInteger s1 = new BigInteger(str1);
      BigInteger s2 = new BigInteger(str2);

BigInteger Library downloaded from https://mattmccutchen.net/bigint/, 2010.04.30 Release

Dave
  • 454
  • 1
  • 7
  • 17

1 Answers1

4

This is how you can convert a std::string to BigInteger:

std::string s("3141592653589793238462643383279");
BigInteger f = stringToBigInteger(s);

Note that the method stringToBigInteger() is declared in BigIntegerUtils.hh.

This and many other sample usages of the library can be found here.

CinCout
  • 9,486
  • 12
  • 49
  • 67