diff options
Diffstat (limited to 'libcxx/test/support')
-rw-r--r-- | libcxx/test/support/DefaultOnly.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libcxx/test/support/DefaultOnly.h b/libcxx/test/support/DefaultOnly.h new file mode 100644 index 00000000000..bdcf46d19ff --- /dev/null +++ b/libcxx/test/support/DefaultOnly.h @@ -0,0 +1,26 @@ +#ifndef DEFAULTONLY_H +#define DEFAULTONLY_H + +#include <cassert> + +class DefaultOnly +{ + int data_; + + DefaultOnly(const DefaultOnly&); + DefaultOnly& operator=(const DefaultOnly&); +public: + static int count; + + DefaultOnly() : data_(-1) {++count;} + ~DefaultOnly() {data_ = 0; --count;} + + friend bool operator==(const DefaultOnly& x, const DefaultOnly& y) + {return x.data_ == y.data_;} + friend bool operator< (const DefaultOnly& x, const DefaultOnly& y) + {return x.data_ < y.data_;} +}; + +int DefaultOnly::count = 0; + +#endif // DEFAULTONLY_H |