~ubuntu-branches/ubuntu/quantal/aspectc++/quantal

« back to all changes in this revision

Viewing changes to AspectC++/tests/PrivateResult/Safe.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
  int _id;
11
11
  Safe (int id) : _id (id) {}
12
12
  Safe &operator = (const Safe &obj) { _id = obj._id; return *this; }
 
13
  class Inner {}; // a private inner type!
13
14
public:
14
15
  Safe (const Safe &obj) { *this = obj; }
15
16
  Safe (const SafeBase &obj) { _id = -1; } // for confusion!
18
19
  // complicated
19
20
  void *operator new (size_t s) { return malloc (s); }
20
21
  void print (ostream &os) const { os << _id; }
 
22
  // the following code is needed to check how wrapper code can access private
 
23
  // inner types
 
24
  friend int main();
 
25
  inline Inner uses_private_inner1 ();
 
26
  inline const Inner &uses_private_inner2 ();
21
27
};
22
28
 
 
29
inline Safe::Inner Safe::uses_private_inner1 () { return Inner (); }
 
30
 
 
31
inline const Safe::Inner &Safe::uses_private_inner2 () {
 
32
  static Inner i;
 
33
  return i;
 
34
}
 
35
 
23
36
ostream &operator << (ostream &os, const Safe& safe) {
24
37
  safe.print (os);
25
38
  return os;
26
39
}
27
40
 
 
41
union AUnion {
 
42
  int i;
 
43
  int j;
 
44
};
 
45
 
28
46
#endif // __Safe_h__