File: bitset1.cpp

package info (click to toggle)
stlport4.6 4.6.2-7
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 7,056 kB
  • ctags: 16,390
  • sloc: ansic: 46,190; cpp: 18,805; sh: 266; asm: 93; perl: 58; makefile: 10
file content (58 lines) | stat: -rw-r--r-- 1,414 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// STLport regression testsuite component.
// To compile as a separate example, please #define MAIN.


#include <stdexcept>
#include <iostream>
#include <bitset>
#include <algorithm>

#if defined (_STLP_MSVC) && (_MSC_VER < 1300)
# define _STLP_NON_TYPE_TMPL_PARAM_BUG
# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
#endif

# ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
# define CHART
# else
# define CHART <char, char_traits<char>, allocator<char> >
# endif

#ifdef MAIN 
#define bitset1_test main
#endif

#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
using namespace std;
#endif

int bitset1_test(int, char**)
{
  cout<<"Results of bitset1_test:"<<endl;

# if ! (defined (_STLP_MSVC) && (_MSC_VER < 1300)) && ! (defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x500))
  bitset<13U> b1(0xFFFF);
  bitset<13U> b2(0x1111);
  // Boris : MSVC just cannot take it right
  cout << "b1 size = " << b1.size() << endl;
# if !defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
  cout << "b1 = "<<b1<<endl;
# else
  cout << "b1 = "<<b1.to_string CHART ()<<endl;
# endif
  cout << "b2 size = " << b2.size() << endl;
# if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
  cout << "b2 = "<<b2.to_string CHART ()<<endl;
# else
  cout << "b2 = "<<b2<<endl;
# endif
  b1 = b1^(b2<<2);
# ifdef _STLP_NON_TYPE_TMPL_PARAM_BUG
  cout << "b1 = "<<b1.to_string CHART ()<<endl;
# else
  cout << "b1 = "<<b1<<endl;
# endif
# endif /* MSVC */
  return 0;
}