Visual C++ Developer Center > Visual C++ Forums > Visual C++ Language > Are dynamic bitsets not supported?
Ask a questionAsk a question
 

AnswerAre dynamic bitsets not supported?

  • Saturday, August 30, 2008 7:18 AMCode_Breaker Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code

    I was trying to use C++ STL bitsets in my code. But I felt that STL doesn't support dynamic bitsets. What I mean to say is that bitsets need to be initialised with a intial maximum number of bits, unlike vectors which grow at runtime.

    bitset<6> b;   //   bitset implementation


    I wan't to do something like this:

    bitset* b;

    b = new bitset(n);   //   where n represents the number of bits in the bitset b.

    And here, the value of n is obviously runtime and not a constant. I could find neither an example nor any specification on this.

    Is this functionality already present in STL bitsets or do I have to implement my own bitset which could provide this?
    And vector<bool> is not an option for me because I want to use the bit logical operations provided by <bitset>

    Please let me have your inputs on this.

    Thanks.

    Elroy D.

Answers

All Replies