Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-05-21 19:35:12


At 03:43 PM 5/21/2001, Beman Dawes wrote:

>At 05:42 PM 3/29/2001, David Abrahams wrote:
>
> >Ah, wonderful. We should put this riff in boost/utility.hpp
> >
> >template <class T>
> >void delete_(T const volatile* x)
> ^^^^^^^^^^^^^^
>What is the rationale for the above CV qualifiers?

To be more explicit, the code I've tested is below. I had to comment out
the const volatile to get it to overload correctly with (you guessed it)
the Microsoft compiler. Original signature worked OK with Borland,
Metrowerks, and GCC. Intel is barfing on unrelated problems - it thinks
long is an incomplete type!

I'm not sure the best workaround, but need this to work for all
compilers. If it doesn't, smart pointers fail, and that in turn causes
other libs like regex to fail.

--Beman

// checked_delete() and
checked_array_delete() -----------------------------//

     // verify that types are complete for increased safety

     template< typename T >
     inline void checked_delete(T /*const volatile*/ * x)
     {
# if !defined(__BORLANDC__) || __BORLANDC__ > 0x0551
         BOOST_STATIC_ASSERT( sizeof(T) ); // assert type complete at point
                                           // of instantiation
# endif
         delete x;
     }

     template< typename T >
     inline void checked_array_delete(T /*const volatile*/ * x)
     {
# if !defined(__BORLANDC__) || __BORLANDC__ > 0x0551
         BOOST_STATIC_ASSERT( sizeof(T) ); // assert type complete at point
                                           // of instantiation
# endif
         delete [] x;
     }


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