diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-09-11 10:59:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-09-11 10:59:24 +0200 |
commit | 2da617e92758c20c9abfd37122864a22e287f896 (patch) | |
tree | 9db8acc615d597c63f62730abd5810e299eaafff | |
parent | 98f995830ab569083540e5edaa42f31a6af4b69d (diff) |
Add support for empty any container
-rw-r--r-- | cutl/container/any.hxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/cutl/container/any.hxx b/cutl/container/any.hxx index 4569b06..9564b2a 100644 --- a/cutl/container/any.hxx +++ b/cutl/container/any.hxx @@ -23,6 +23,10 @@ namespace cutl struct LIBCUTL_EXPORT typing: exception {}; public: + any () + { + } + template <typename X> any (X const& x) : holder_ (new holder_impl<X> (x)) @@ -70,13 +74,25 @@ namespace cutl throw typing (); } - public: std::type_info const& type_info () const { return holder_->type_info (); } + public: + bool + empty () const + { + return holder_.get () == 0; + } + + void + reset () + { + return holder_.reset (); + } + private: class LIBCUTL_EXPORT holder { |