]> git.lyx.org Git - lyx.git/blob - src/support/utility.h
Create a grfx::Loader class and so move large chunks of code out of
[lyx.git] / src / support / utility.h
1 //  boost utility.hpp header file  -------------------------------------------//
2
3 //  (C) Copyright boost.org 1999. Permission to copy, use, modify, sell
4 //  and distribute this software is granted provided this copyright
5 //  notice appears in all copies. This software is provided "as is" without
6 //  express or implied warranty, and with no claim as to its suitability for
7 //  any purpose.
8
9 //  See http://www.boost.org for most recent version including documentation.
10
11 //  Classes appear in alphabetical order
12
13 //  Revision History
14 //  21 May 01  checked_delete() and checked_array_delete() added (Beman Dawes,
15 //             suggested by Dave Abrahams, generalizing idea from Vladimir Prus)
16 //  21 May 01  made next() and prior() inline (Beman Dawes)
17 //  26 Jan 00  protected noncopyable destructor added (Miki Jovanovic)
18 //  10 Dec 99  next() and prior() templates added (Dave Abrahams)
19 //  30 Aug 99  moved cast templates to cast.hpp (Beman Dawes)
20 //   3 Aug 99  cast templates added
21 //  20 Jul 99  name changed to utility.hpp
22 //   9 Jun 99  protected noncopyable default ctor
23 //   2 Jun 99  Initial Version. Class noncopyable only contents (Dave Abrahams)
24
25 #ifndef LYX_UTILITY_H
26 #define LYX_UTILITY_H
27
28 #include <boost/config.hpp>        // broken compiler workarounds
29 #include <boost/static_assert.hpp>
30 //#include <cstddef>                 // for size_t
31 //#include <utility>                 // for std::pair
32
33 #ifndef CXX_GLOBAL_CSTD
34 using std::free;
35 #endif
36
37 namespace lyx
38 {
39 //  checked_delete() and checked_array_delete()  -----------------------------//
40
41     // verify that types are complete for increased safety
42
43     template< typename T >
44     inline void checked_delete(T * x)
45     {
46         BOOST_STATIC_ASSERT( sizeof(T) != 0 ); // assert type complete at point
47                                                // of instantiation
48         ::free(x);
49     }
50
51 } // namespace boost
52
53 #endif  // BOOST_UTILITY_HPP