4 #ifndef UTILMM_FUNCTIONAL_CACHED_FN_HEADER
5 # define UTILMM_FUNCTIONAL_CACHED_FN_HEADER
7 #include "utilmm/config/config.h"
58 template<
typename Arg,
typename Ret,
class Hash=hash<Arg>,
59 class Equal=std::equal_to<Arg> >
61 :
public std::unary_function<Arg, Ret> {
78 virtual Ret
call(Arg
const &arg) =0;
120 return the_cache.
size();
126 # define IN_UTILMM_FUNCTIONAL_CACHED_FN_HEADER
127 #include "utilmm/functional/bits/cached_fn.tcc"
128 # undef IN_UTILMM_FUNCTIONAL_CACHED_FN_HEADER
129 #endif // UTILMM_FUNCTIONAL_CACHED_FN_HEADER
Declaration of utilmm::hash_map.
void clear()
Remove all elements.
Definition: hash_map.hh:197
cached_fn()
Default constructor.
Definition: cached_fn.hh:85
size_t cache_size() const
Cache size.
Definition: cached_fn.hh:119
A functor with cache.
Definition: cached_fn.hh:60
size_t size() const
element count
Definition: hash_map.hh:81
virtual ~cached_fn()
Destructor.
Definition: cached_fn.hh:87
void empty_cache()
clear the cache
Definition: cached_fn.hh:111
Ret const & operator()(arg_type arg)
Call operator.
virtual Ret call(Arg const &arg)=0
the real function.
computed_type type
argument type
Definition: arg_traits.hh:38