Mercurial > emacs
view test/cedet/tests/teststruct.cpp @ 106009:e6af95c4c862
Use gcc-generated dependency files if we can (GNU Make and gcc required).
* Makefile.in: If AUTO_DEPEND is defined, make gcc generate
dependency files in deps/. Include those files into Makefile.
* config.in: Generated (AUTO_DEPEND).
* configure.in: --enable-autodepend is new. Check for GNU Make
and that gcc supports -MMD -MF. Define AUTO_DEPEND if we can use
gcc and GNU make to generate dependencies.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Sat, 14 Nov 2009 15:17:38 +0000 |
parents | 7f4c7f5c0eba |
children |
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") } // arch-tag: d6e39f96-525e-44af-8cd1-d03e1829acd3