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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:40:31+00:00 2026-05-24T10:40:31+00:00

I can’t figure out if I’m doing anything wrong here, hopefully someone here can

  • 0

I can’t figure out if I’m doing anything wrong here, hopefully someone here can enlighten me.

I have a class Flags, this is an extremely simplified version but I declare a bitset

class Flags
{
private:
    //List of 8 bits
    std::bitset<8> _P;
public:
    Flags();
}

On my constructor I initialise it as

Flags::Flags()
    : _P(32ul)
{}

But it won’t compile and gives me the error

error C2668: ‘std::bitset<_Bits>::bitset’ : ambiguous call to
overloaded function

This is compiled in VS2010 SP1 64 bit but as a 32bit program

EDIT

Accepted answer is for the above but as a side note could anyone explain why when using the default constructor (which should initialise them all to zero’s) they aren’t all set to zero’s?

_p.to_ulong()

returns 1390560944
and _p looks like

[8](0,0,0,0,1,1,0,1)
  • 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-24T10:40:32+00:00Added an answer on May 24, 2026 at 10:40 am

    It’s a bug in VC according to http://connect.microsoft.com/VisualStudio/feedback/details/532897/problems-constructing-a-bitset-from-an-unsigned-long-in-the-vc-rc

    Also note that identifiers starting with _ and a capital letter are reserved for the implementation and illegal to use in your program.

    EDIT: According to the workaround page (if I read it right), the workaround is to cast your value to unsigned long long instead of unsigned long.

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

Sidebar

Related Questions

Can someone tell me what I am doing wrong? This is my first time
Can someone tell me where I'm going wrong here? basically I've written some code
Can find why i get this error can someone help? package Android.data; public class
Can someone help me figure out why my logo image isn't resizing according the
Can someone please help me find the memory leak which is occurring here? I
Can anyone tell me what i am doing wrong? I am trying to get
can someone explain what means this line, or provide with source where it is
Can someone please explain how this code is working for me? I don't understand
Can any one help me in sorting this out in sed/awk/perl Input file Start
can someone tell me why sed won't remove my NULLs? this is on OS

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.