Mercurial > emacs
view test/cedet/tests/teststruct.cpp @ 104508:90ca5d588aa9
* cedet/semantic.el: Add autoloads for semantic/idle functions.
* cedet/semantic/util.el (semantic--completion-cache): New var.
(semantic-symbol-start, semantic-find-tag-for-completion)
(semantic-complete-symbol): New functions, adapted from Senator.
* bindings.el (complete-symbol): Try semantic-complete-symbol if
no tag table is active.
* cedet/semantic/idle.el (define-semantic-idle-service): Doc fix.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 21 Sep 2009 15:59:48 +0000 |
parents | e480034314ce |
children | 7f4c7f5c0eba |
line wrap: on
line source
// Combinations of templates and structure inheritance. // // Created by Alex Ott. template <typename DerivedT> struct grammar { public: typedef grammar<DerivedT> self_t; typedef DerivedT const& embed_t; grammar() {} ~grammar() { } void use_parser() const { } void test1() { } }; struct PDFbool_parser : public grammar<PDFbool_parser> { PDFbool_parser() {} template <typename scannerT> struct definition { typedef typename scannerT::iterator_t iterator_t; int top; definition(const PDFbool_parser& /*self*/) { return ; } const int start() const { return top; } }; }; int main(void) { PDFbool_parser PDFbool_p = PDFbool_parser(); PDFbool_p.//-1- ; // #1# ("definition" "embed_t" "self_t" "test1" "use_parser") } // ---------------------------------------------------------------------- template <class Derived> struct Base { public: void interface() { // ... static_cast<Derived*>(this)->implementation(); // ... } static void static_func() { // ... Derived::static_sub_func(); // ... } }; struct Derived : Base<Derived> { void implementation() { } static void static_sub_func() { } }; int foo () { Derived d; d.//-2- ; // #2# ("implementation" "interface" "static_func" "static_sub_func") }