Boost logo

Boost :

Subject: Re: [boost] [functional] How to avoid a dependency on functional?
From: Peter Dimov (lists_at_[hidden])
Date: 2015-01-09 21:39:46

Andrzej Krzemienski wrote:

> > Is there any recommended way to avoid the functional dependency?
> A good question. For the same reason I am reluctant to implement hash
> support in Boost.Optional.

Optional is easier because you can forward-declare just hash<> and then
return empty()? 0: hash<T>()( t_ ).

Like shared_ptr.hpp does:

// hash_value

template< class T > struct hash;

template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p )
    return boost::hash< T* >()( p.get() );

Boost list run by bdawes at, gregod at, cpdaniel at, john at