From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-29 23:10:45
----- Original Message -----
From: "Douglas Gregor" <gregod_at_[hidden]>
Sent: Tuesday, January 29, 2002 10:35 PM
Subject: [boost] Boost.Function optimization for stateless function objects
> I've just committed some changes to Boost.Function so that it will
> away unnecessary allocations and copying of stateless function objects.
> construction of or assignment to a Boost.Function object given a stateless
> function object will not throw, and will not allocate any memory.
> To do this, a new type trait, is_stateless, has been added to
> boost/type_traits/object_traits.hpp. The definition of is_stateless is:
> template <typename T>
> struct is_stateless
> BOOST_STATIC_CONSTANT(bool, value =
> The functionality has been tested under GCC, Comeau, and MSVC without any
> problems. Documentation may lag behind a bit, but I'm working on it.
> Comments always welcome.
So, as I understand it, is_stateless requires user intervention or compiler
It seems to me that you'd want is_stateless to be true in the following
T is a function pointer
T is const (? maybe not -- there might be a state* const in it)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk