TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
#include <large_number.h>
Public Member Functions | |
large_number () | |
large_number (int n) | |
large_number (const large_number &a) | |
large_number (std::vector< unsigned char > &vec) | |
large_number (char const *number_str) | |
void | add_digit (unsigned int value) |
size_t | num_digits () const |
unsigned char & | operator[] (size_t n) |
const unsigned char & | operator[] (size_t n) const |
large_number & | operator++ () |
large_number & | operator++ (int) |
large_number & | operator+= (large_number n) |
large_number & | operator+= (int n) |
large_number & | operator= (const large_number &b) |
template<class T > | |
large_number & | operator*= (const T n) |
char | digit_char (size_t i) const |
Static Public Member Functions | |
static bool | test () |
Private Member Functions | |
template<class T > | |
void | multiply (const T n) |
Private Attributes | |
std::vector< unsigned char > | _digits |
Friends | |
std::ostream & | operator<< (std::ostream &out, const large_number &a) |
bool | operator== (large_number const &a, large_number const &b) |
bool | operator!= (large_number const &a, large_number const &b) |
template<class T > | |
large_number & | operator+ (const large_number &a, const T &b) |
Store large unsigned numbers as a C++ vector The class provides convenience functions to add a digit to the number, perform multiplication of large number with long unsigned integers.
Definition at line 24 of file large_number.h.
|
inline |
< initializer with value = 1
Definition at line 27 of file large_number.h.
|
inlineexplicit |
< initializer from an integer < initializer from an integer initializer from another large_number
Definition at line 39 of file large_number.h.
|
inline |
initializer from a vector
Definition at line 48 of file large_number.h.
|
inlineexplicit |
initializer from a string
Definition at line 51 of file large_number.h.
|
inlineexplicit |
Definition at line 54 of file large_number.h.
|
inline |
add a digit at MSB to the large number
Definition at line 118 of file large_number.h.
|
inline |
|
inlineprivate |
multiply large number with another integer and store the result in the same large number
Definition at line 258 of file large_number.h.
|
inline |
|
inline |
operator overload to increment
Definition at line 238 of file large_number.h.
|
inline |
operator overload to increment (prefix)
Definition at line 175 of file large_number.h.
|
inline |
operator overload to increment (postfix)
Definition at line 183 of file large_number.h.
|
inline |
Definition at line 212 of file large_number.h.
|
inline |
operator overload to add
Definition at line 192 of file large_number.h.
|
inline |
assignment operator
Definition at line 229 of file large_number.h.
|
inline |
operator over load to access the i^th digit conveniently and also assign value to it
Definition at line 137 of file large_number.h.
|
inline |
Definition at line 139 of file large_number.h.
|
inlinestatic |
Function to check implementation
Definition at line 65 of file large_number.h.
|
friend |
operator overload to compare two numbers
Definition at line 168 of file large_number.h.
|
friend |
operator overload to perform addition
Definition at line 220 of file large_number.h.
|
friend |
operator overload to compare two numbers
Definition at line 146 of file large_number.h.
|
friend |
operator overload to compare two numbers
Definition at line 155 of file large_number.h.
|
private |
where individual digits are stored
Definition at line 285 of file large_number.h.