Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page 432: Bitset example does not pass tests. The bit order tests in it are backwards. #104

WraithGlade opened this issue Jan 11, 2020 · 1 comment


Copy link

@WraithGlade WraithGlade commented Jan 11, 2020

The code in the book looks like this:

TEST_CASE("std::bitset supports integer initialization") 
	std::bitset<4> bs(0b0101);

But the code needed to actually pass the test is this:

TEST_CASE("std::bitset supports integer initialization") 
	std::bitset<4> bs(0b0101);

The original code tests the bits in human reading order, but the passing test requires them to instead be ordered in least-significant to most-significant bit order.

Perhaps you accidentally forgot to compile this example.

Alternatively, I suppose a bit ordering difference is also conceivable, although I doubt it. I'm on a 64-bit version of Windows 7, running Visual Studio C++ 2019, in case that's relevant in that case.

(Also, as usual, I'm on the Kindle ebook version of the book.)


This comment has been minimized.

Copy link

@JLospinoso JLospinoso commented Jan 21, 2020

Thanks, @WraithGlade! I specifically remember fixing this during copyedit. Hmm...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.