$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Rainer Deyke (root_at_[hidden])
Date: 2002-03-11 17:38:12
I have replaced the cache template class at
http://groups.yahoo.com/group/boost/files/cache.zip with a new
version. The major new feature is that there are strong and weak
handles. Strong handles ('cache<...>::handle') guarantee that the
referenced object is in the cache and are analogous to
'boost::shared_ptr'. Weak handles are analogous to 'boost::weak_ptr'
and require conversion to a strong handle before use.
typedef cache<string, bitmap> bitmap_cache_t;
bitmap_cache_t bitmap_cache;
bitmap_cache_t::handle foo = bitmap_cache.get_handle("foo.bmp");
foo->draw();
bitmap_cache_t::weak_handle weak_bar =
bitmap_cache.get_handle("bar.bmp");
bitmap_cache_t::handle bar = weak_bar.get();
bar->draw();
There are various possible improvements in both interface and
implementation. However, I would like opinions on what I already have
before I start making random improvements. Is the general design
acceptable? Is something like this desired in Boost?
-- Rainer Deyke | root_at_[hidden] | http://rainerdeyke.com