10

Does STL have a BigInt class implementation? (numbers with many digits held into a container)

Ardent Coder
  • 3,777
  • 9
  • 27
  • 53
XCS
  • 27,244
  • 26
  • 101
  • 151

3 Answers3

16

The C++ standard library (sometimes erroneously referred to as "STL") does not contain any extended precision support.

Mark Ransom
  • 299,747
  • 42
  • 398
  • 622
  • 1
    Why is Standard Template Library erroneously called STL? – XCS Feb 15 '11 at 15:34
  • @Cristy, STL is the name of a specific template library implementation that predates the C++ standardization, which is mostly but not completely compatible. I might have been a little harsh, I remember now Scott Meyers' book is called "Effective STL" - if such an authority still uses the term, it should be OK for the rest of us. – Mark Ransom Feb 15 '11 at 17:30
  • The STL is just a small part of the C++ standard library. – Chris Dodd May 29 '11 at 18:42
  • 3
    The Standard Template Library *is* the STL, but STL does not refer to the C++ standard library. The Standard Template Library is just a small part of the C++ standard library as Chris Dodd said. The C++ standard library contains the STL and more. I hope this clears up any confusion. – Phoenix Mar 27 '13 at 12:10
  • @Phoenix, the truth is more nuanced than that - see http://stackoverflow.com/questions/5205491/whats-this-stl-vs-c-standard-library-fight-all-about – Mark Ransom Mar 27 '13 at 15:31
  • @MarkRansom in light of that comment perhaps you could remove the word "erroneously" from your answer... – M.M Aug 07 '15 at 01:24
  • @MattMcNabb I still think it's an error, just one that's easily forgiven. As humans we appreciate having simple names for things. Ask Xerox and Kleenex how they feel about that subject. – Mark Ransom Aug 07 '15 at 04:21
8

No, but MPIR/GMP have C++ interfaces.

Cat Plus Plus
  • 125,936
  • 27
  • 200
  • 224
5

Unfortunately, the C++ standard library does not natively support arbitrarily long integers. However, these libraries can help you getting the job done:

Mathieu Rodic
  • 6,637
  • 2
  • 43
  • 49
  • 1
    Such a comprehensive list should also include boost multiprecision: http://www.boost.org/doc/libs/master/libs/multiprecision/doc/html/index.html – Mr.WorshipMe Mar 24 '17 at 10:17