File: test_non_copyable_recursive.hpp

package info (click to toggle)
pygccxml 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,444 kB
  • sloc: xml: 29,841; python: 13,914; cpp: 2,671; makefile: 163; ansic: 59
file content (52 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (4)
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
// Copyright 2014-2016 Insight Software Consortium.
// Copyright 2004-2008 Roman Yakovenko.
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt

#include <sstream>

// Demonstration of the real problem with basic c++
namespace Test1 {

// Forward declaration
class Base2;

// Base 1, with pointer to Base2
class Base1 {
  private:
    Base1();

  protected:
    Base2* aBasePtr2;
};

// Base 2, child class of Base1
class Base2: public Base1 {
  private:
    Base2();
};

// Child class of Base2
// Holds a pointer to Base2
class Child: public Base2 {
  private:
    Child();

  protected:
    Base2* aBasePtr2;
};

}

// Real-life test with std::istream where this happened
namespace Test2 {

class FileStreamDataStream {
  public:
    FileStreamDataStream(const std::istream* s) {}

  protected:
    std::istream* mInStream;
  };
}