COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/deba/test.cpp @ 1258:88dff8bb4bf2

Last change on this file since 1258:88dff8bb4bf2 was 1210:f02396423239, checked in by Balazs Dezso, 20 years ago

work modifications

File size: 1.4 KB
Line 
1#include <iostream>
2
3using namespace std;
4
5#include <lemon/utility.h>
6
7using namespace std;
8/*
9struct _EmptyList {
10  void write() const {}
11};
12
13template <typename _Item, typename _Next>
14struct _AddNode {
15  typedef _Next Next;
16  typedef _Item Item;
17 
18  const Item item;
19  const Next& next;
20 
21  _AddNode(const Item& _item, const Next& _next)
22    : item(_item), next(_next) {}
23
24  void write() const {
25    next.write();
26    cout << item << ' ';
27  }
28};
29
30template <typename _List = _EmptyList>
31struct _Writer {
32  typedef _List List;
33
34  const List list;
35
36  _Writer(const List& _list = List()) : list(_list) {}
37
38 
39  template <typename Item> _Writer<_AddNode<Item, List> > add(Item item) const {
40    return _Writer<_AddNode<Item, List> >(_AddNode<Item, List>(item, list));
41  }
42
43  void write() const {
44    list.write();
45    cout << endl;
46  }
47};
48
49
50typedef _Writer<> Writer;
51
52int main() {
53  Writer().add(3).add("alpha").add(4.53).write();
54}
55*/
56
57class A {
58public:
59  typedef int X;
60};
61
62class C {
63};
64
65template <typename A>
66class TRUE {
67public:
68  static const bool state = true;
69};
70
71template <typename _A>
72class B {
73public:
74  typedef enable_if<A::X, int> state;
75};
76
77template <typename _A>
78class B<_A, void> {
79public:
80  static const bool state = true;
81};
82
83int main() {
84  printf("%s\n", B<A>::state(), true ? "true" : "false");
85  printf("%s\n", B<C>::state(), true ? "true" : "false");
86  return 0;
87}
Note: See TracBrowser for help on using the repository browser.