bitset 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 1998
  3. * Silicon Graphics Computer Systems, Inc.
  4. *
  5. * Copyright (c) 1999
  6. * Boris Fomitchev
  7. *
  8. * This material is provided "as is", with absolutely no warranty expressed
  9. * or implied. Any use is at your own risk.
  10. *
  11. * Permission to use or copy this software for any purpose is hereby granted
  12. * without fee, provided the above notices are retained on all copies.
  13. * Permission to modify the code and to distribute modified code is granted,
  14. * provided the above notices are retained, and a notice that the code was
  15. * modified is included with the above copyright notice.
  16. *
  17. */
  18. #ifndef _STLP_BITSET
  19. // This implementation of bitset<> has a second template parameter,
  20. // _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE
  21. // THIS FEATURE*. It is experimental, and it may be removed in
  22. // future releases.
  23. // A bitset of size N, using words of type _WordT, will have
  24. // N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high-
  25. // order bits in the highest word.) It is a class invariant
  26. // of class bitset<> that those unused bits are always zero.
  27. // Most of the actual code isn't contained in bitset<> itself, but in the
  28. // base class _Base_bitset. The base class works with whole words, not with
  29. // individual bits. This allows us to specialize _Base_bitset for the
  30. // important special case where the bitset is only a single word.
  31. // The C++ standard does not define the precise semantics of operator[].
  32. // In this implementation the const version of operator[] is equivalent
  33. // to test(), except that it does no range checking. The non-const version
  34. // returns a reference to a bit, again without doing any range checking.
  35. #ifndef _STLP_OUTERMOST_HEADER_ID
  36. # define _STLP_OUTERMOST_HEADER_ID 0x2
  37. # include <stl/_prolog.h>
  38. # define _STLP_BITSET
  39. #endif
  40. #if (_STLP_OUTERMOST_HEADER_ID == 0x2)
  41. # ifndef _STLP_INTERNAL_BITSET
  42. # include <stl/_bitset.h>
  43. # endif
  44. #endif
  45. #if (_STLP_OUTERMOST_HEADER_ID != 0x2) || defined (_STLP_IMPORT_VENDOR_STD)
  46. # if defined (_STLP_HAS_INCLUDE_NEXT)
  47. # include_next <bitset>
  48. # else
  49. # include _STLP_NATIVE_HEADER(bitset)
  50. # endif
  51. #endif
  52. #if (_STLP_OUTERMOST_HEADER_ID == 0x2 )
  53. # include <stl/_epilog.h>
  54. # undef _STLP_OUTERMOST_HEADER_ID
  55. #endif
  56. #endif /* _STLP_BITSET */
  57. // Local Variables:
  58. // mode:C++
  59. // End: