Implementation of C + + Bitset

Source: Internet
Author: User

C + + in Bitset very convenient to implement the bit operation, there are a few points to note, you can refer to the source code:

Https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.2/bitset-source.html


Its template is

00645   template<size_t _nb>00646     class bitset00647     : Private _base_bitset<_glibcxx_bitset_ WORDS (_NB) >

Size_t is the first address that has been obtained at compile time , and then the _NB is _NW,_NW for template generalization, except for each size:

00077   template<size_t _nw>00078     struct _base_bitset00079     {00080       typedef unsigned long _wordt ; 00081 00082///0 is the       least significant word.00083 _wordt _M_W[_NW        ];

So Bitset don't need to save a first address like a vector .。。。

Implementation of C + + Bitset

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.