Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8133441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:36:27+00:00 2026-06-06T09:36:27+00:00

I have a set of bitsets pointers in an unordered_map static unordered_map< size_t, bitset<BITSIZE>*

  • 0

I have a set of bitsets pointers in an unordered_map

static unordered_map< size_t, bitset<BITSIZE>* > systemBits;

And my function

template<typename system>
     static bitset<BITSIZE> & getBitFor() {

    size_t hash = typeid(system).hash_code();

    bitset<BITSIZE> * bit = systemBits[hash];

    if(bit == NULL) {
        bit = new bitset<BITSIZE>(0);
        (*bit) << POS++; // tried *bit << POS++ as well;
        systemBits[hash] = bit;
    }

    return *bit;
}

Whereas POS is an int set to 1 at first.

All that I’m trying to do is shift the bitset with the amounts of position per new bitset.

 (*bit) << POS++;

However this doesn’t seem to work. When I cout the returned bitset all its bits are set to 0.
If I do to the following:

bit->flip();

or
(*bit).flip();

The bitset returned does flip all the 0 to 1.

What gives? Why does the shift operator have no effect at all?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:36:28+00:00Added an answer on June 6, 2026 at 9:36 am

    Because you’re not assigning the result to anything . You’d have the same problem if you were trying to shift an int.

    Also, you’ve initialized your bitset to zero, and zero shifted by any amount is always zero.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function where i use bitset.Now i need to convert it to
I have set up in javascript: var onBeforeUnloadFired = false; window.onbeforeunload = function (sender,
We have set up a system where notifications get sent to a user with
i have set in .htaccess Url Rewrite all working just my search function stop
I have set up multiple targets in a single xml file. I expect all
I have set up 2 servers which are linked. From my LOCAL SERVER, I
I have :set hlsearch as default value. When I search for something, search terms
We have set up a SharePoint meeting workspace (using WSS 3.0) for our weekly
I have set up an AJAX contact form on a client's website. The problem
I have set up Team Foundation Server - Team Web Access SP1. I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.