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 6722093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:24:24+00:00 2026-05-26T09:24:24+00:00

I was learning stl and never saw this kind of class like class classname

  • 0

I was learning stl and never saw this kind of class like class classname :: reference {}

I searched on the net but could get good information ..

class bitset::reference {
  friend class bitset;
  reference();                                 // no public constructor
public:
  ~reference();
  operator bool () const;                      // convert to bool
  reference& operator= ( bool x );             // assign from bool
  reference& operator= ( const reference& x ); // assign from bit
  reference& flip();                           // flip bit value
  bool operator~() const;                      // return inverse value
};
  • what is this :: reference here for ?

i saw this code here[enter link description here][1]
http://www.cplusplus.com/reference/stl/bitset/
i have worked on c++ before.

  • 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-05-26T09:24:24+00:00Added an answer on May 26, 2026 at 9:24 am

    Did you look at the bitset class definition? There is something like this somewhere:

    template<size_t _Bits>
    class bitset
    {
        ...
        class reference;
        ...
    }
    

    It’s much like putting the body of a funciton outside the class body. Now we are putting the body of a nested class outside of the parent class:

    class bitset::reference
    {
        /* class body */
    }
    

    By the way, in MSVC (C:\Program Files\Microsoft Visual Studio 9.0\VC\include\bitset) the’re actually defined inside each other:

    // TEMPLATE CLASS bitset
    template<size_t _Bits>
    class bitset
    {   // store fixed-length sequence of Boolean elements
    typedef unsigned long _Ty;  // base type for a storage word
    enum {digits = _Bits};  // extension: compile-time size()
    
    public:
    typedef bool element_type;  // retained
    
        // CLASS reference
    class reference
        {   // proxy for an element
        friend class bitset<_Bits>;
        .
        .
        .
    

    It’s the same for g++’s bitset.h, although a bit more complex.

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

Sidebar

Related Questions

Just learning the world of jquery, and all my googling gives examples like this:
Learning Ruby. Needed to create a hash of arrays. This works... but I don't
I'm learning C++ and can't get my head around this problem: I have a
Learning regex but this one gives me a headache. I need to match a
After learning good amount of c++, i'm now into STL containers and algorithms template
Learning some VBA. So far, I've constructed this piece of code which should allow
I am learning STL and design patterns . i wanted to know is there
I would like to do some parsing and tokenizing in c++ for learning purposes.
Learning jquery, so please be kind :) Using PHP, I have a table with
Learning spine.js I completed both the tutorials no problem, seems like a great framework,

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.