Learn C++ STL

Lesson 3 of 9 ¡ bitset and Bit Tricks: Sixty-Four Booleans in One Word

Module 15 ¡ bitset and Bit Tricks: Sixty-Four Booleans in One Word

Five Programs That Give Each Bit a Job

Free with an accountReading

Amara has several small jobs on her desk. One uses option flags, another checks numbered tokens, and another marks possible package weights. The stored bits look similar. Their meanings, update rules, and valid ranges are different.

Checking what this lesson needs for youâ€Ļ

What is inside Five Programs That Give Each Bit a Job

  1. Options fit inside an unsigned mask
  2. Seen means a bounded identifier exists
  3. Alignment turns movement into shifts
  4. Reachability instead of counts
  5. Exactly one choice needs replacement
  6. A sieve marks composite numbers
  7. Choose what must survive the update