src/work/deba/test.cpp
changeset 1267 a93f94dbe3d3
parent 1210 f02396423239
     1.1 --- a/src/work/deba/test.cpp	Fri Mar 25 22:11:28 2005 +0000
     1.2 +++ b/src/work/deba/test.cpp	Fri Mar 25 23:31:57 2005 +0000
     1.3 @@ -4,7 +4,7 @@
     1.4  
     1.5  #include <lemon/utility.h>
     1.6  
     1.7 -using namespace std;
     1.8 +using namespace lemon;
     1.9  /*
    1.10  struct _EmptyList {
    1.11    void write() const {}
    1.12 @@ -57,31 +57,28 @@
    1.13  class A {
    1.14  public:
    1.15    typedef int X;
    1.16 +  typedef True XD;
    1.17  };
    1.18  
    1.19  class C {
    1.20  };
    1.21  
    1.22 -template <typename A> 
    1.23 -class TRUE {
    1.24 +
    1.25 +template <typename _A, bool _B = false> 
    1.26 +class B {
    1.27 +public:
    1.28 +  static const bool state = false;
    1.29 +};
    1.30 +
    1.31 +template <typename _A> 
    1.32 +class B<_A, typename enable_if<typename _A::XD, void>::type> {
    1.33  public:
    1.34    static const bool state = true;
    1.35  };
    1.36  
    1.37 -template <typename _A> 
    1.38 -class B {
    1.39 -public:
    1.40 -  typedef enable_if<A::X, int> state;
    1.41 -};
    1.42 -
    1.43 -template <typename _A>
    1.44 -class B<_A, void> {
    1.45 -public:
    1.46 -  static const bool state = true;
    1.47 -};
    1.48  
    1.49  int main() {
    1.50 -  printf("%s\n", B<A>::state(), true ? "true" : "false");
    1.51 -  printf("%s\n", B<C>::state(), true ? "true" : "false");
    1.52 +  printf("%s\n", B<A>::state ? "true" : "false");
    1.53 +  printf("%s\n", B<C>::state ? "true" : "false");
    1.54    return 0;
    1.55  }