Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2001-10-17 17:05:56


----- Original Message -----
From: Douglas Gregor <gregod_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, October 17, 2001 4:51 PM
Subject: Re: [boost] Re: Boosting boost

> [SNIP]
>
> Fernando Cacciola's idea of using "peek" instead of "any_cast" might make
> this more clear. The _cast implies a conversion of some sort, whereas
"peek"
> doesn't convey this notion of conversion.
>
> Doug
>
And can be added to the interface without breaking any existing code...

namespace boost {

  template<typename ValueType>
  ValueType acquire( const any & operand ) { return
any_cast<ValueType>(operand) ; }

  template<typename ValueType>
  ValueType * peek( any * operand ) { return any_cast<ValueType>(operand)
; }

  template<typename ValueType>
  const ValueType * peek( const any * operand ) { return
any_cast<ValueType>(operand) ; }

}

If Kevlin would agree with this idiom he could update the code and the
documentation quite easily.. (hint, hint)

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk