C++ Library –

C++ Library – <deque> ”; Previous Next Introduction Deque is acronym for Double Ended Queue. It is a sequence container that can change it”s size runtime. Container is an object that holds data of same type. Sequence containers store elements strictly in linear sequence. Elements of deque can be scattered in different chunks of memory. Container stores necessary information to allow direct access to any element in constant time. Unlike vectors, deque are not guaranteed to store all it”s element at contiguous memory locations. Hence it does not allow direct access to data by offsetting pointers. But it enables direct access to any element using subscript operator [ ]. Deque can shrink or expand as needed from both ends at run time. The storage requirement is fulfilled automatically by internal allocator. Deque provides similar functionality as vectors, but provides efficient way to insert and delete data from any end. Zero sized deques are also valid. In that case deque.begin() and deque.end() points to same location. But behavior of calling front() or back() is undefined. Definition Below is definition of std::deque from <deque> header file template < class T, class Alloc = allocator<T> > class deque; Parameters T − Type of the element contained. T may be substituted by any other data type including user-defined type. Alloc − Type of allocator object. By default, the allocator class template is used, which defines the simplest memory allocation model and is value-independent. Member types Following member types can be used as parameters or return type by member functions. Sr.No. Member types Definition 1 value_type T (First parameter of the template) 2 allocator_type Alloc (Second parameter of the template) 3 reference value_type& 4 const_reference const value_type& 5 pointer value_type* 6 const_pointer const value_type* 7 iterator a random access iterator to value_type 8 const_iterator a random access iterator to const value_type 9 reverse_iterator std::reverse_iterator <iterator> 10 const_reverse_iterator std::reverse_iterator <const_iterator> 11 size_type size_t 12 difference_type ptrdiff_t Functions from <deque> Below is list of all methods from <deque> header. Constructors Sr.No. Method & Description 1 deque::deque default constructor Constructs an empty deque with zero element. 2 deque::deque fill constructor construct a new deque with n elements and assign val to each element of deque 3 deque::deque range constructor Constructs a deque with as many elements as in range of first to last. 4 deque::deque copy constructor Constructs a deque with copy of each elements present in existing container. 5 deque::deque move constructor Constructs a deque with the contents of other using move semantics. 6 deque::deque initializer list constructor Constructs a deque from initialize list. Destructor Sr.No. Method & Description 1 deque::~deque Destroys deque object by deallocating it”s memory. Member functions Sr.No. Method & Description 1 deque::assign Assign new values to the deque elements by replacing old ones. 2 deque::at Returns reference to the element present at location n in the deque. 3 deque::back Returns a reference to the last element of the deque. 4 deque::begin Return a random access iterator pointing to the first element of the deque. 5 deque::cbegin Returns a constant random access iterator which points to the beginning of the deque. 6 deque::cend Returns a constant random access iterator which points to the beginning of the deque. 7 deque::clear Destroys the deque by removing all elements from the deque and sets size of deque to zero. 8 deque::crbegin Returns a constant reverse iterator which points to the reverser beginning of the container. 9 deque::crend Returns a constant reverse iterator which points to the reverse end of the deque. 10 deque::emplace Extends container by inserting new element at position. 11 deque::emplace_back Inserts new element at the end of deque. 12 deque::emplace_front Inserts new element at the beginning of deque. 13 deque::empty Tests whether deque is empty or not. 14 deque::end Returns an iterator which points to past-the-end element in the deque container. 15 deque::erase Removes single element from the the deque. 16 deque::front Returns a reference to the first element of the deque 17 deque::get_allocator Returns an allocator associated with deque 18 deque::insert Extends container by inserting new element in the deque. 19 deque::max_size Returns the maximum number of elements can be held by deque. 20 deque::operator= Assign new contents to the deque by replacing old ones and modifies size if necessary. 21 deque::operator[] Returns a reference to the element present at location n. 22 deque::pop_back Removes last element from deque and reduces size of deque by one. 23 deque::pop_front Removes first element from deque and reduces size of deque by one. 24 deque::push_back Inserts new element at the end of deque and increases size of deque by one. 25 deque::push_front Inserts new element at the front of deque and increases size of deque by one. 26 deque::rbegin Returns a reverse iterator which points to the last element of the deque. 27 deque::rend Returns a reverse iterator which points to the reverse end of the deque. 28 deque::resize Changes the size of deque. 29 deque::shrink_to_fit Requests the container to reduce it”s capacity to fit its size. 30 deque::size Returns the number of elements present in the deque. 31 deque::swap Exchanges the content of deque with contents of another deque. Non-member overloaded functions Sr.No. Method & Description 1 operator== Tests whether two deques are equal or not. 2 operator!= Tests whether two deques are equal or not. 3 operator< Tests whether first deque is less than other or not. 4 operator<= Tests whether first deque is less than or equal to other or not. 5 operator> Tests whether first deque is greater than other or not. 6 operator>= Tests whether first deque is greater than or equal to other or not. Print Page Previous Next Advertisements ”;

C++ Library –

C++ Library – <memory> ”; Previous Next Introduction It defines general utilities to manage dynamic memory in header. Allocators Sr.No. Allocator & description 1 allocator It is a default allocator. 2 allocator_arg It is an allocator arg. 3 allocator_arg_t It is a allocator arg type. 4 allocator_traits It is an allocator allocator traits. Managed pointers Sr.No. Managed pointers description 1 auto_ptr It is an automatic Pointer. 2 auto_ptr_ref It is a reference to automatic pointer. 3 shared_ptr It is a shared pointer. 4 weak_ptr It is a weak shared pointer. 5 unique_ptr It is an unique pointer. 6 default_delete It is a default deleter. Functions and classes related to shared_ptr Sr.No. Functions and classes related to shared_ptr & description 1 make_shared It is used to make shared_ptr. 2 allocate_shared It is used to allocate shared_ptr. 3 static_pointer_cast It is a static cast of shared_ptr. 4 dynamic_pointer_cast It is a dynamic cast of shared_ptr. 5 const_pointer_cast It is a const cast of shared_ptr. 6 get_deleter It is used to get deleter from shared_ptr. 7 owner_less It is a numeric punctuation facet. 8 enable_shared_from_this It enables shared_from_this. Print Page Previous Next Advertisements ”;

C++ Library –

C++ Library – <unordered_set> ”; Previous Next Introduction It is an associative container that store unique elements in no particular order, and which allow for fast retrieval of individual elements based on their value. Definition Below is definition of std::unordered_set template < class Key, class Hash = hash<Key>, class Pred = equal_to<Key>, class Alloc = allocator<Key> > class unordered_set; Parameters Key − It defines the type of element. Hash − It is a unary function object. Pred − It is a binary predicate that takes two arguments of the same type as the elements and returns a bool. Alloc − It defines the type of allowcater. Member types Following member types can be used as parameters or return type by member functions. Member Type Definition Notes key_type It is the first template parameter (Key) value_type It is the first template parameter (Key) The same as key_type hasher It is the second template parameter (Hash) defaults to: hash<key_type> key_equal It is the third template parameter (Pred) defaults to: equal_to<key_type> allocator_type It is the fourth template parameter (Alloc) defaults to: allocator<value_type> reference Alloc::reference const_reference Alloc::const_reference pointer Alloc::pointer for the default allocator: value_type* const_pointer Alloc::const_pointer for the default allocator: const value_type* iterator a forward iterator to const value_type * convertible to const_iterator const_iterator a forward iterator to const value_type * local_iterator a forward iterator to const value_type * convertible to const_local_iterator const_local_iterator a forward iterator to const value_type * size_type an unsigned integral type usually the same as size_t difference_type a signed integral type usually the same as ptrdiff_t Member functions Below is list of member functions Sr.No. Method & Description operator= It is used to assign the content. Capacity Sr.No. Capacity & Description 1 empty It is used to test whether container is empty. 2 size It returns container size. 3 max_size It returns maximum size. Iterators Sr.No. Iterators & Description 1 begin It returns iterator to beginning. 2 end It returns iterator to end. 3 cbegin It returns const_iterator to beginning. 4 cend It return const_iterator to end. Element lookup Sr.No. Element lookup & Description 1 find It is used to get iterator to element. 2 count It is used to count elements with a specific key. 3 equal_range It is used to get range of elements with a specific key. Modifiers Sr.No. Modifiers & Description 1 emplace It is used to construct and insert element. 2 emplace_hint It is used to construct and insert element with hint. 3 insert It is used to insert elements. 4 erase It is used to erase elements. 5 clear It is used to clear content. 6 swap It is used to swap content. Buckets Sr.No. Buckets & Description 1 bucket_count It returns number of buckets. 2 max_bucket_count It returns maximum number of buckets. 3 bucket_size It returns bucket size. 4 bucket It locates element”s bucket. Hash policy Sr.No. Hash policy & Description 1 load_factor It returns load factor. 2 max_load_factor It is used to get or set maximum load factor. 3 rehash It is used to set number of buckets. 4 reserve It gives a request to capacity chage of backets Observers Sr.No. Observers & Description 1 hash_function It is used to get hash function. 2 key_eq It is used to get key equivalence predicate. 3 get_allocator It is used to get allocator. Non-member overloaded functions Sr.No. Non-member function overloads & Description 1 operator== Tests whether two maps are equal or not. 2 operator!= Tests whether two maps are equal or not. 3 swap It exchanges contents of two unordered_set containers. Print Page Previous Next Advertisements ”;

C++ Library –

C++ Library – <vector> ”; Previous Next Introduction Vectors are sequence container that can change size. Container is a objects that hold data of same type. Sequence containers store elements strictly in linear sequence. Vector stores elements in contiguous memory locations and enables direct access to any element using subscript operator []. Unlike array, vector can shrink or expand as needed at run time. The storage of the vector is handled automatically. To support shrink and expand functionality at runtime, vector container may allocate some extra storage to accommodate for possible growth thus container have actual capacity greater than the size. Therefore, compared to array, vector consumes more memory in exchange for the ability to manage storage and grow dynamically in an efficient way. Zero sized vectors are also valid. In that case vector.begin() and vector.end() points to same location. But behavior of calling front() or back() is undefined. Definition Below is definition of std::vector from <vector> header file template < class T, class Alloc = allocator<T> > class vector; Parameters T − Type of the element contained. T may be substituted by any other data type including user-defined type. Alloc − Type of allocator object. By default, the allocator class template is used, which defines the simplest memory allocation model and is value-independent. Member types Following member types can be used as parameters or return type by member functions. Sr.No. Member types Definition 1 value_type T (First parameter of the template) 2 allocator_type Alloc (Second parameter of the template) 3 reference value_type& 4 const_reference const value_type& 5 pointer value_type* 6 const_pointer const value_type* 7 iterator a random access iterator to value_type 8 const_iterator a random access iterator to const value_type 9 reverse_iterator std::reverse_iterator <iterator> 10 const_reverse_iterator std::reverse_iterator <const_iterator> 11 size_type size_t 12 difference_type ptrdiff_t Functions from <vector> Below is list of all methods from <vector> header. Constructors Sr.No. Method & Description 1 vector::vector default constructor Constructs an empty container, with zero elements. 2 vector::vector fill constructor Constructs a container with n elements and assignd val to each element. 3 vector::vector range constructor Constructs a container with as many elements in range of first to last. 4 vector::vector copy constructor Constructs a container with copy of each elements present in existing container x. 5 vector::vector move constructor Constructs the container with the contents of other using move semantics. 6 vector::vector initializer list constructor Constructs a container from initializer list. Destructor Sr.No. Method & Description 1 vector::~vector Destroys container by deallocating container memory. Member functions Sr.No. Method & Description 1 vector::assign fill version Assign new values to the vector elements by replacing old ones. 2 vector::assign range version Assign new values to the vector elements by replacing old ones. 3 vector::assign initializer list version Assign new values to the vector elements by replacing old ones. 4 vector::at Returns reference to the element present at location n in the vector. 5 vector::back Returns a reference to the last element of the vector. 6 vector::begin Return a random access iterator pointing to the first element of the vector. 7 vector::capacity Returns the size of allocate storage, expressed in terms of elements. 8 vector::cbegin Returns a constant random access iterator which points to the beginning of the vector. 9 vector::cend Returns a constant random access iterator which points to the beginning of the vector. 10 vector::clear Destroys the vector by removing all elements from the vector and sets size of vector to zero. 11 vector::crbegin Returns a constant reverse iterator which points to the reverser beginning of the container. 12 vector::crend Returns a constant reverse iterator which points to the reverse end of the vector. 13 vector::data Returns a pointer to the first element of the vector container. 14 vector::emplace Extends container by inserting new element at position. 15 vector::emplace_back Inserts new element at the end of vector. 16 vector::empty Tests whether vector is empty or not. 17 vector::end Returns an iterator which points to past-the-end element in the vector container. 18 vector::erase position version Removes single element from the the vector. 19 vector::erase range version Removes single element from the the vector. 20 vector::front Returns a reference to the first element of the vector. 21 vector::get_allocator Returns an allocator associated with vector. 22 vector::insert single element version Extends iterator by inserting new element at position. 23 vector::insert fill version Extends vector by inserting new element in the container. 24 vector::insert range version Extends vector by inserting new element in the container. 25 vector::insert move version Extends vector by inserting new element in the container. 26 vector::insert initializer list version Extends vector by inserting new element in the container. 27 vector::max_size Returns the maximum number of elements can be held by vector. 28 vector::operator= copy version Assign new contents to the vector by replacing old ones and modifies size if necessary. 29 vector::operator= move version Assign new contents to the vector by replacing old ones and modifies size if necessary. 30 vector::operator = initializer list version Assign new contents to the vector by replacing old ones and modifies size if necessary. 31 vector::operator[] Returns a reference to the element present at location n. 32 vector::pop_back Removes last element from vector and reduces size of vector by one. 33 vector::push_back Inserts new element at the end of vector and increases size of vector by one. 34 vector::rbegin Returns a reverse iterator which points to the last element of the vector. 35 vector::rend Returns a reverse iterator which points to the reverse end of the vector. 36 vector::reserve Requests to reserve vector capacity be at least enough to contain n elements. 37 vector::resize Changes the size of vector. 38 vector::shrink_to_fit Requests the container to reduce it”s capacity to fit its size. 39 vector::size Returns the number of elements present in the vector. 40 vector::swap Exchanges the content of vector with contents of vector x. Non-member overloaded functions Sr.No. Method & Description 1 operator == Tests whether two vectors are equal or not. 2 operator != Tests whether two vectors are equal or

C++ Library –

C++ Library – <forward_list> ”; Previous Next Introduction forward_list is a popularly used sequence container. Container is an object that holds data of same type. forward_list container is implemented as singly linked-list, hence it provides unidirectional sequential access to it”s data. forward_list doesn”t provide fast random access, it only supports sequential access in only one directions. forward_list allows insertion and deletion operation anywhere within a sequence in constant time. Elements of forward_list can be scattered in different chunks of memory. Container stores necessary information to allow sequential access to it”s data. forward_lists can shrink or expand as needed from both ends at run time. The storage requirement is fulfilled automatically by internal allocator. Zero sized forward_lists are also valid. In that case forward_list.begin() and forward_list.end() points to same location. But behavior of calling front() is undefined. Definition Below is definition of std::forward_list from <forward_list> header file template < class T, class Alloc = allocator<T> > class forward_list; Parameters T − Type of the element contained. T may be substituted by any other data type including user-defined type. Alloc − Type of allocator object. By default, the allocator class template is used, which defines the simplest memory allocation model and is value-independent. Member types Following member types can be used as parameters or return type by member functions. Sr.No. Member types Definition 1 value_type T (First parameter of the template) 2 allocator_type Alloc (Second parameter of the template) 3 reference value_type& 4 const_reference const value_type& 5 pointer value_type* 6 const_pointer const value_type* 7 iterator a random access iterator to value_type 8 const_iterator a random access iterator to const value_type 9 size_type size_t 10 difference_type ptrdiff_t Functions from <forward_list> Below is list of all methods from <forward_list> header. Constructors Sr.No. Method & Description 1 forward_list::forward_list default constructor Constructs an empty forward_list with zero elements. 2 forward_list::forward_list fill constructor Constructs a new forward_list with n elements and assigns val to each element of forward_list. 3 forward_list::forward_list fill constructor Constructs a new forward_list with n elements and assign zero value to each element of forward_list. 4 forward_list::forward_list range constructor Constructs a forward_list with as many elements as in range of first to last. 5 forward_list::forward_list copy constructor Constructs a forward_list with copy of each elements present in existing list. 6 forward_list::forward_list move constructor Constructs a forward_list with the contents of other using move semantics. 7 forward_list::forward_list initializer list constructor Constructs a forward_list from initialize list. Destructor Sr.No. Method & Description 1 forward_list::~forward_list Destroys forward_list object by deallocating it”s memory. Member functions Sr.No. Method & Description 1 forward_list::assign range version Assigns new value to forward_list by replacing old ones. 2 forward_list::assign fill version Assigns new values to forward_list by replacing old ones. 3 forward_list::assign initializer list version Assigns new values to forward_list by replacing old ones. 4 forward_list::before_begin Returns a random access iterator which points to the position before the first element of the forward_list. 5 forward_list::begin Returns a random access iterator which points to the first element of the forward_list. 6 forward_list::cbefore_begin Returns a constant random access iterator which points to the position before the first element of the forward_list. 7 forward_list::cbegin Returns a constant random access iterator which points to the beginning of the forward_list. 8 forward_list::cend Returns a constant random access iterator which points to the end of the forward_list. 9 forward_list::clear Destroys the forward_list by removing all elements from the forward_list and sets size of forward_list to zero. 10 forward_list::emplace_after Constructs and inserts new element after position in the forward_list and increases size of forward_list by one. 11 forward_list::emplace_front Inserts new element at the beginning of the forward_list and increases size of forward_list by one. 12 forward_list::empty Tests whether forward_list is empty or not. 13 forward_list::end Returns a random access iterator which points to the last element of the forward_list. 14 forward_list::erase_after position version Removes single element after position from the the forward_list. 15 forward_list::erase range version Removes range of element from the the forward_list. 16 forward_list::front Returns a reference to the first element of the forward_list. 17 forward_list::get_allocator Returns an allocator associated with forward_list 18 forward_list::insert_after single element version Extends iterator by inserting new element after position in forward_list 19 forward_list::insert_after move version Extends iterator by inserting new element after position in forward_list 20 forward_list::insert_after fill version Extends iterator by inserting new element after position in forward_list 21 forward_list::insert_after range version Extends iterator by inserting new element after position in forward_list 22 forward_list::insert_after initializer list version Extends iterator by inserting new element after position in forward_list 23 forward_list::max_size Returns the maximum number of elements can be held by forward_list. 24 forward_list::merge Merges two sorted forward_lists into one. 25 forward_list::merge move version Merges two sorted forward_lists into one. 26 forward_list::merge compare function Merges two sorted forward_lists into one. 27 forward_list::merge compare function move version Merges two sorted forward_lists into one by using move semantics. 28 forward_list::operator= copy version Assigns new contents to the forward_list by replacing old ones. 29 forward_list::operator= move version Assign new contents to the forward_list by replacing old ones. 30 forward_list::operator= initializer list version Assign new contents to the forward_list by replacing old ones. 31 forward_list::pop_front Removes first element from forward_list. 32 forward_list::push_front copy version Inserts new element at the beginning of forward_list. 33 forward_list::push_front move version Inserts new element at the beginning of forward_list. 34 forward_list::remove removes element(s) from the forward_list that matches the value. 35 forward_list::remove_if removes elements from the forward_list that fulfills the condition. 36 forward_list::resize Changes the size of forward_list. 37 forward_list::resize value version Changes the size of forward_list. 38 forward_list::reverse Reverses the order of the elements present in the forward_list. 39 forward_list::sort Sorts the elements of the forward_list. 40 forward_list::sort compare function Sorts the elements of the forward_list. 41 forward_list::splice_after Transfers all elements from forward_list to *this. 42 forward_list::splice_after move version Transfers all elements from forward_list x to *this by using move semantics. 43 forward_list::splice_after single element Transfers a element pointed to by iterator i from forward_list x into *this. 44 forward_list::splice_after single element move version Transfers the element

C++ Library –

C++ Library – <priority_queue> ”; Previous Next The C++ Priority_queue is a container adaptor from the STL that provides the dynamic priority queue data structure. It is implemented as a binary heap, allowing efficient insertion, removal and access to the highest or lowest priority elements. By default, it orders elements in descending order based on a comparator function.Priority queues are commonly used in algorithms like Dijkstra”s shortest path and Prim”s minimum spanning tree. Syntax Below is the syntax of std::priority_queue. template <class T, class Container = vector<T>, class Compare = less<typename Container::value_type> < class priority_queue; Parameters T − Type of the element contained. T may be substituted by any other data type including user-defined type. Container − Type of the underlying container object. Compare − Comparison object to be used to order the priority_queue. This may be a function pointer or function object that can compare its two arguments. Member types Following member types can be used as parameters or return type by member functions. Sr.No. Member types Definition 1 value_type T (First parameter of the template) 2 container_type Second parameter of the template 3 size_type size_t 4 reference value_type& 5 const_reference const value_type& 6 difference_type ptrdiff_t Functions from <priority_queue> Below is list of all methods from <priority_queue> . Constructors Sr.No. Method & Description 1 priority_queue::priority_queue default constructor Constructs an empty priority_queue with zero element. 2 priority_queue::priority_queue initialize constructor Constructs a priority_queue object and assigns internal container by a copy of ctnr. 3 priority_queue::priority_queue range constructor Constructs a priority_queue with as many elements in range of first to last. 4 priority_queue::priority_queue move constructor Constructs the priority_queue with the contents of other using move semantics. 5 priority_queue::priority_queue copy constructor Constructs a priority_queue with copy of each elements present in existing priority_queue other. Destructor Sr.No. Method & Description 1 priority_queue::~priority_queue Destroys priority_queue by deallocating container memory. Member functions Sr.No. Method & Description 1 priority_queue::emplace Constructs and inserts new element in sorted order in the priority_queue. 2 priority_queue::empty Tests whether pritority_queue is empty or not. 3 priority_queue::operator= Assigns new contents to the priority_queue by replacing old ones. 4 priority_queue::pop Removes front element of the priority_queue. 5 priority_queue::push Inserts new element in sorted order. 6 priority_queue::size Returns the total number of elements present in the priority_queue. 7 priority_queue::swap Exchanges the contents of priority_queue with contents of another priority_queue. 8 priority_queue::top Returns a reference to the first element of the priority_queue Print Page Previous Next Advertisements ”;

C++ Library –

C++ Library – <array> ”; Previous Next Introduction Arrays are sequence container of fixed size. Container is a objects that holds data of same type. Sequence containers store elements strictly in linear sequence. The container class uses implicit constructor to allocate required memory statically. Memory is allocated at the compile time, hence array size cannot shrink or expand at runtime. All elements inside array are located at contiguous memory locations. Definition Below is definition of std::array from <array> header file. template < class T, size_t N > class array; Parameters T − Type of the element contained. T may be substituted by any other data type including user-defined type. N − Size of the array. Zero sized arrays are also valid. In that case array.begin() and array.end() points to same location. But behavior of calling front() or back() is undefined. Member types Following member types can be used as parameters or return type by member functions. Sr.No. Member types Definition 1 value_type T (First parameter of the template) 2 reference value_type& 3 const_reference const value_type& 4 pointer value_type* 5 const_pointer const value_type* 6 iterator a random access iterator to value_type 7 const_iterator a random access iterator to const value_type 8 reverse_iterator std::reverse_iterator <iterator> 9 const_reverse_iterator std::reverse_iterator <const_iterator> 10 size_type size_t 11 difference_type ptrdiff_t Functions from <array> Below is list of all methods from <array> header. Member functions Sr.No. Method & Description 1 array::at Returns a reference to the element present at location N in given array container. 2 array::back Returns a reference to the last element of the array container. 3 array::begin Returns an iterator which points to the start of the array. 4 array::cbegin Returns a constant iterator which points to the start of the array. 5 array::cend Returns a constant iterator which points to the past-end element of array. 6 array::crbegin Returns a constant reverse iterator pointing to the last element of the array. 7 array::crend Returns a constant reverse iterator which points to the past-end. 8 array::data Return a pointer pointing to the first element of the array container. 9 array::empty Tests whether size of array is zero or not. 10 array::end Returns an iterator which points to the past-end element of array. 11 array::fill Sets given value to all elements of array. 12 array::front Returns a reference to the first element of the array container. 13 array::max_size Returns the maximum number of elements that can be held by array container. 14 array::operator[] Returns a reference to the element present at location N in a given array container. 15 array::rbegin Returns a reverse iterator pointing to the last element of the array. 16 array::rend Returns a reverse iterator which points to the theoretical element preceding to first element of the array. 17 array::size Returns the number of elements present in the array. 18 array::swap Swap the contents of the two array. Non-member overloaded functions Sr.No. Method & Description 1 get(array) Returns reference to the Ith element of the array container. 2 bool operator== Tests whether two containers are identical or not 3 bool operator!= Tests whether two containers are identical or not 4 bool operator< Tests whether first array container is less than second or not. 5 bool operator<= Tests whether first array container is less than or equal to second or not. 6 bool operator> Tests whether first array container is greater than second or not. 7 bool operator>= Tests whether first array container is greater than or equal to second or not. Non-member specilization functions Sr.No. Method & Description 1 tuple_element(array) Provides compile-type indexed access to the type of the elements of the array using tuple-like interface. 2 tuple_size(array) Returns the total number of elements present in the container. Print Page Previous Next Advertisements ”;

C++ Library –

C++ Library – <stdexcept> ”; Previous Next Introduction It is an exception classes and this header defines a set of standard exceptions that both the library and programs can use to report common errors. Classes Sr.No. Logic error & description 1 logic_error It is a logic error exception. 2 domain_error It is a domain error exception. 3 invalid_argument It is an invalid argument exception. 4 length_error It is a length error exception. 5 out_of_range It is an out-of-range exception. Convenience interfaces Sr.No. Interface & description 1 runtime_error It is a runtime error exception. 2 range_error It is a range error exception. 3 overflow_error It is an overflow error exception. 4 underflow_error It is an underflow error exception. Print Page Previous Next Advertisements ”;

C++ Library –

C++ Library – <multimap> ”; Previous Next Introduction to multimap Multimap is dictionary like data structure. It is a sequence of (key, value) pair, where multiple values can be associate with equivalent keys. It is often referred as associative array. In multimap key values generally used to sort the elements. For multimap data type of key and value can differ and it is represented as typedef pair<const Key, T> value_type; Multimaps are typically implemented as Binary Search Tree. Zero sized multimaps are also valid. In that case multimap.begin() and multimap.end() points to same location. Definition Below is definition of std::multimap from <multimap> header file template < class Key, class T, class Compare = less<Key>, class Alloc = allocator<pair<const Key,T> > > class multimap; Parameters Key − Type of the key. T − Type of the mapped values. Compare − A binary predicate that takes two element keys as arguments and returns a bool. Alloc − Type of the allocator object. T may be substituted by any other data type including user-defined type. Member types Following member types can be used as parameters or return type by member functions. Sr.No. Member types Definition 1 key_type Key (First parameter of the template) 2 mapped_type T (Second parameter of the template) 3 key_compare Compare (Third parameter of the template) 4 allocator_type Alloc (Fourth parameter of the template) 5 value_type pair<const key_type,mapped_type> 6 value_compare Nested function class to compare elements 7 reference allocator_type::reference 8 const_reference allocator_type::const_reference 9 pointer allocator_type::pointer 10 const_pointer allocator_type::const_pointer 11 iterator bi-directional iterator to value_type 12 const_iterator bi-directional iterator to const value_type 13 reverse_iterator reverse iterator 14 const_reverse_iterator constant reverse iterator 15 difference_type ptrdiff_t 16 size_type size_t Functions from <multimap> Below is list of all methods from <multimap> header. Constructors Sr.No. Method & Description 1 multimap::multimap default constructor Constructs an empty multimap with zero elements. 2 multimap::multimap range constructor Constructs a multimap with as many elements as in range of first to last. 3 multimap::multimap copy constructor Constructs a multimap with copy of each elements present in existing multimap. 4 multimap::multimap move constructor Constructs a multimap with the contents of other using move semantics. 5 multimap::multimap initializer list constructor Constructs a multimap from initialize list. Destructor Sr.No. Method & Description 1 multimap::~multimap Destroys multimap object by deallocating it”s memory. Member functions Sr.No. Method & Description 1 multimap::begin Returns a iterator which refers to the first element of the multimap. 2 multimap::cbegin Returns a constant iterator which refers to the first element of the multimap. 3 multimap::cend Returns a constant iterator which points to past-the-end element of the multimap. 4 multimap::clear Destroys the multimap by removing all elements and sets size of multimap to zero. 5 multimap::count Returns number of multimapped values associated with key k. 6 multimap::crbegin Returns a constant reverse iterator which points to the last element of the container. 7 multimap::crend Returns a constant reverse iterator which points to the theoretical element preceding the first element in the container. 8 multimap::emplace Extends container by inserting new element. 9 multimap::emplace_hint hint version Inserts a new element in a multimap using hint as a position for element. 10 multimap::empty Tests whether multimap is empty or not. 11 multimap::end Returns an iterator which points to past-the-end element in the multimap. 12 multimap::equal_range Returns range of elements that matches specific key. 13 multimap::erase The erase() function is used to remove the elements from a container. 14 multimap::find Finds an element associated with key k. 15 multimap::get_allocator Returns an allocator associated with multimap. 16 multimap::insert The C++ insert() function is used to add elements to a multimap container. 17 multimap::key_comp Returns a function object that compares the keys, which is a copy of this container”s constructor argument comp. 18 multimap::lower_bound Returns an iterator pointing to the first element which is not less than key k. 19 multimap::max_size Returns the maximum number of elements can be held by multimap. 20 multimap::operator= The operator=() function is used to assigns the contents of one multimap to another 21 multimap::rbegin Returns a reverse iterator which points to the last element of the multimap. 22 multimap::rend Returns a reverse iterator which points to the reverse end of the multimap. 23 multimap::size Returns the number of elements present in the multimap. 24 multimap::swap Exchanges the content of multimap with contents of multimap x. 25 multimap::upper_bound Returns an iterator pointing to the first element which is greater than key k. 26 multimap::value_comp Returns a function object that compares objects of type std::multimap::value_type. Non-member overloaded functions Sr.No. Method & Description 1 operator== Tests whether two multimaps are equal or not. 2 operator!= Tests whether two multimaps are equal or not. 3 operator< Tests whether first multimap is less than other or not. 4 operator&lt= Tests whether first multimap is less than or equal to other or not. 5 operator> Tests whether first multimap is greater than other or not. 6 operator>= Tests whether first multimap is greater than or equal to other or not. Print Page Previous Next Advertisements ”;

C++ Library –

C++ Library – <bitset> ”; Previous Next Introduction Bitset represents a fixed-size sequence of N bits and stores values either 0 or 1. Zero means value is false or bit is unset and one means value is true or bit is set. Bitset class emulates space efficient array of boolean values, where each element occupies only one bit. As it emulates array, its index also starts from 0th position. Individual bit from bitset can be accessed using subscript operator. For instance to access first element of bitset foo use foo[0]. Bitset class provides constructors to create bitset from integer as well as from strings. The size of the bitset is fixed at compile time. STL provides vector<bool> class that provides dynamic resize functionality. Definition Below is definition of std::bitset from <bitset> header file template <size_t N> class bitset; Parameters N − Size of the bitset. Member types Following member types can be used as parameters or return type by member functions. Sr.No. Member types Definition 1 reference Proxy class that represents a reference to a bit. Functions from <bitset> Below is list of all methods from <bitset> header. Constructors Sr.No. Method & Description 1 bitset::bitset() Constructs bitset container and initialize it with zero. 2 bitset::bitset() Constructs bitset container and initialize it with the bit value of val. 3 bitset::bitset() Constructs and initializes a bitset container from C++ string object. 4 bitset::bitset() Constructs and initializes a bitset container from c-style string. Member class Sr.No. Method & Description 1 bitset::reference() This is embedded class which provides l-value that can be returned from std::bitset::operator[]. Bitset operators Sr.No. Method & Description 1 bitset::operator&= Performs bitwise AND operation on current bitset object. 2 bitset::operator|= Performs bitwise OR operation on current bitset object. 3 bitset::operator^= Performs bitwise XOR operation on current bitset object. 4 bitset::operator<<= Performs bitwise left SHIFT operation on current bitset object. 5 bitset::operator>>= Performs bitwise right SHIFT operation on current bitset object. 6 bitset::operator~ Performs bitwise NOT operation on bitset. 7 bitset::operator<< Performs bitwise left SHIFT operation on bitset. 8 bitset::operator>> Performs bitwise right SHIFT operation on bitset. 9 bitset::operator== Test whether two bitsets are equal or not. 10 bitset::operator!= Test whether two bitsets are equal or not. 11 bitset::operator& Performs bitwise AND operation on bitset. 12 bitset::operator| Performs bitwise OR operation on bitset. 13 bitset::operator^ Performs bitwise XOR operation on bitset. 14 bitset::operator>> Extracts upto N bits from is and stores into another bitset x. 15 bitset::operator>> Inserts bitset x to the character stream os. Member functions Sr.No. Method & Description 1 bitset::all() Tests whether all bits from bitset are set or not. 2 bitset::any() Tests whether at least one bit from bitset is set or not. 3 bitset::count() Count number of set bits from bitset. 4 bitset::flip() all bits Toggles all bits from bitset. 5 bitset::flip() single bit Toggles single bit from bitset. 6 bitset::none() Tests whether all bits are unset or not. 7 bitset::operator[] bool version Returns the value of bit at position pos. 8 bitset::operator[] reference version Returns the reference of bit at position pos. 9 bitset::reset() all bits Reset all bits of bitset to zero. 10 bitset::reset() single bit Reset single bit of bitset to zero. 11 bitset::set() all bits Set all bits from bitset to one. 12 bitset::set() single bit Set single bit from bitset to either one or zero. 13 bitset::size() Reports the size of the bitset. 14 bitset::test() Tests whether Nth bit is set or not. 15 bitset::to_string() Converts bitset object to string object. 16 bitset::to_ullong() Convert bitset to unsigned long long. 17 bitset::to_ulong() Convert bitset to unsigned long. Non-member functions Sr.No. Method & Description 1 bitset::hash() Returns hash value based on the provided bitset. Print Page Previous Next Advertisements ”;