diff options
Diffstat (limited to 'test/cedet/tests/teststruct.cpp')
| -rw-r--r-- | test/cedet/tests/teststruct.cpp | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/test/cedet/tests/teststruct.cpp b/test/cedet/tests/teststruct.cpp deleted file mode 100644 index 8ecdc548871..00000000000 --- a/test/cedet/tests/teststruct.cpp +++ /dev/null | |||
| @@ -1,68 +0,0 @@ | |||
| 1 | // Combinations of templates and structure inheritance. | ||
| 2 | // | ||
| 3 | // Created by Alex Ott. | ||
| 4 | |||
| 5 | template <typename DerivedT> | ||
| 6 | struct grammar { | ||
| 7 | public: | ||
| 8 | typedef grammar<DerivedT> self_t; | ||
| 9 | typedef DerivedT const& embed_t; | ||
| 10 | grammar() {} | ||
| 11 | ~grammar() { } | ||
| 12 | void use_parser() const { } | ||
| 13 | void test1() { } | ||
| 14 | }; | ||
| 15 | |||
| 16 | struct PDFbool_parser : public grammar<PDFbool_parser> { | ||
| 17 | PDFbool_parser() {} | ||
| 18 | template <typename scannerT> struct definition { | ||
| 19 | typedef typename scannerT::iterator_t iterator_t; | ||
| 20 | int top; | ||
| 21 | definition(const PDFbool_parser& /*self*/) { | ||
| 22 | return ; | ||
| 23 | } | ||
| 24 | const int start() const { | ||
| 25 | return top; | ||
| 26 | } | ||
| 27 | }; | ||
| 28 | }; | ||
| 29 | |||
| 30 | int main(void) { | ||
| 31 | PDFbool_parser PDFbool_p = PDFbool_parser(); | ||
| 32 | PDFbool_p.//-1- | ||
| 33 | ; | ||
| 34 | // #1# ("definition" "embed_t" "self_t" "test1" "use_parser") | ||
| 35 | } | ||
| 36 | |||
| 37 | // ---------------------------------------------------------------------- | ||
| 38 | |||
| 39 | template <class Derived> struct Base { | ||
| 40 | public: | ||
| 41 | void interface() | ||
| 42 | { | ||
| 43 | // ... | ||
| 44 | static_cast<Derived*>(this)->implementation(); | ||
| 45 | // ... | ||
| 46 | } | ||
| 47 | |||
| 48 | static void static_func() | ||
| 49 | { | ||
| 50 | // ... | ||
| 51 | Derived::static_sub_func(); | ||
| 52 | // ... | ||
| 53 | } | ||
| 54 | }; | ||
| 55 | |||
| 56 | struct Derived : Base<Derived> { | ||
| 57 | void implementation() { } | ||
| 58 | static void static_sub_func() { } | ||
| 59 | }; | ||
| 60 | |||
| 61 | int foo () { | ||
| 62 | Derived d; | ||
| 63 | d.//-2- | ||
| 64 | ; | ||
| 65 | // #2# ("implementation" "interface" "static_func" "static_sub_func") | ||
| 66 | } | ||
| 67 | |||
| 68 | // arch-tag: d6e39f96-525e-44af-8cd1-d03e1829acd3 | ||