A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/cpp_standard_library/bitset.htm below:

C++ Bitset

C++ Library - <bitset> 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 Member functions Non-member functions Sr.No. Method & Description 1 bitset::hash()

Returns hash value based on the provided bitset.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4