src/work/deba/test.cpp
changeset 1365 c280de819a73
parent 1364 ee5959aa4410
child 1366 d00b85f8be45
     1.1 --- a/src/work/deba/test.cpp	Sun Apr 17 18:57:22 2005 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,84 +0,0 @@
     1.4 -#include <iostream>
     1.5 -
     1.6 -using namespace std;
     1.7 -
     1.8 -#include <lemon/utility.h>
     1.9 -
    1.10 -using namespace lemon;
    1.11 -/*
    1.12 -struct _EmptyList {
    1.13 -  void write() const {}
    1.14 -};
    1.15 -
    1.16 -template <typename _Item, typename _Next>
    1.17 -struct _AddNode {
    1.18 -  typedef _Next Next;
    1.19 -  typedef _Item Item;
    1.20 -  
    1.21 -  const Item item;
    1.22 -  const Next& next;
    1.23 -  
    1.24 -  _AddNode(const Item& _item, const Next& _next) 
    1.25 -    : item(_item), next(_next) {}
    1.26 -
    1.27 -  void write() const {
    1.28 -    next.write();
    1.29 -    cout << item << ' ';
    1.30 -  }
    1.31 -};
    1.32 -
    1.33 -template <typename _List = _EmptyList>
    1.34 -struct _Writer {
    1.35 -  typedef _List List;
    1.36 -
    1.37 -  const List list;
    1.38 -
    1.39 -  _Writer(const List& _list = List()) : list(_list) {}
    1.40 -
    1.41 -  
    1.42 -  template <typename Item> _Writer<_AddNode<Item, List> > add(Item item) const {
    1.43 -    return _Writer<_AddNode<Item, List> >(_AddNode<Item, List>(item, list));
    1.44 -  }
    1.45 -
    1.46 -  void write() const {
    1.47 -    list.write();
    1.48 -    cout << endl;
    1.49 -  }
    1.50 -};
    1.51 -
    1.52 -
    1.53 -typedef _Writer<> Writer;
    1.54 -
    1.55 -int main() {
    1.56 -  Writer().add(3).add("alpha").add(4.53).write();
    1.57 -}
    1.58 -*/
    1.59 -
    1.60 -class A {
    1.61 -public:
    1.62 -  typedef int X;
    1.63 -  typedef True XD;
    1.64 -};
    1.65 -
    1.66 -class C {
    1.67 -};
    1.68 -
    1.69 -
    1.70 -template <typename _A, bool _B = false> 
    1.71 -class B {
    1.72 -public:
    1.73 -  static const bool state = false;
    1.74 -};
    1.75 -
    1.76 -template <typename _A> 
    1.77 -class B<_A, typename enable_if<typename _A::XD, void>::type> {
    1.78 -public:
    1.79 -  static const bool state = true;
    1.80 -};
    1.81 -
    1.82 -
    1.83 -int main() {
    1.84 -  printf("%s\n", B<A>::state ? "true" : "false");
    1.85 -  printf("%s\n", B<C>::state ? "true" : "false");
    1.86 -  return 0;
    1.87 -}