From 2da617e92758c20c9abfd37122864a22e287f896 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 11 Sep 2011 10:59:24 +0200 Subject: Add support for empty any container --- cutl/container/any.hxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'cutl') 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 any (X const& x) : holder_ (new holder_impl (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 { -- cgit v1.1