$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-02-04 10:10:48
On Monday 04 February 2002 07:59 am, you wrote:
> I think that if we add another template parameter to boost::function,
> Storage, with requirements that 
> (1) sizeof(Storage) >= sizeof(void*), 
Okay.
> (2) an object of type Storage always has the correct alignment for every 
> type T such that sizeof(T) <= sizeof(Storage), 
Just for reference - how is this accomplished? Portably?
> then (a) the implementation of boost::function could be simplified, 
Going to have to go whip up some proof pudding on this one. I would 
definately say that this small string optimization should be factored out 
into its own library, because I'm sure there are many libraries that could 
benefit from this. boost::any surely comes to mind, as it's been requested 
before that boost::any support the small string optimization. Something like:
template<typename Storage = default_storage>
struct small_string_optimization {
  template<typename T>
  struct can_optimize {
    BOOST_STATIC_CONSTANT(bool, value = /* whatever */);
  };
  template<typename T> T* storage(T* = 0 /* msvc hack */) 
    { return /* pointer to internal storage */; }
};
        Doug