cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : STL Containers : bitset : none
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forum
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
STL Containers
bitset
deque
list
map
multimap
multiset
priority_queue
queue
set
stack
vector
bitset
bitset::bitset
bitset operators
member functions:
· bitset::any
· bitset::count
· bitset::flip
· bitset::none
· bitset::operator[]
· bitset::reset
· bitset::set
· bitset::size
· bitset::test
· bitset::to_string
· bitset::to_ulong

-

bitset::none public member function
bool none ( ) const;

Test if no bit is set

Returns whether none of the bits in the bitset are set.

Parameters

none

Return value

true if none of the bits in the bitset are set, and false otherwise.

Example

// bitset::none
#include <iostream>
#include <bitset>
using namespace std;

int main ()
{
  bitset<16> mybits;

  cout << "enter a binary number: ";
  cin >> mybits;

  if (mybits.none())
    cout << "mybits has no bits set.\n";
  else
    cout << "mybits has " << (int)mybits.count() << " bits set.\n";

  return 0;
}

See also

bitset::count Count bits set (public member function)
bitset::any Test if any bit is set (public member function)
bitset::test Return bit value (public member function)

© The C++ Resources Network, 2000-2007 - All rights reserved
Spotted an error? - contact us