Major merge from 'dev'
[libcds.git] / cds / user_setup / allocator.h
1 //$$CDS-header$$
2
3 #ifndef CDSLIB_USER_SETUP_ALLOCATOR_H
4 #define CDSLIB_USER_SETUP_ALLOCATOR_H
5
6 /** \file
7     \brief Default implementation of allocator classes.
8
9     If you want to use your allocator implementation you should define all or one of the following macro before
10     including CDS library headers:
11     \li CDS_DEFAULT_ALLOCATOR
12     \li CDS_DEFAULT_ALIGNED_ALLOCATOR
13 */
14
15 #ifndef CDS_DEFAULT_ALLOCATOR
16
17     /** \def CDS_DEFAULT_ALLOCATOR
18         The macro defines standard allocator implementation. Default is std::allocator.
19
20         The CDS library uses \p std::allocator<int> to emulate template template parameter.
21         The library uses the <tt> std::allocator<int>::rebind<Q>::other </tt> to redefine allocator's type to proper type \p Q.
22     */
23 #define CDS_DEFAULT_ALLOCATOR        std::allocator<int>
24
25 #    include <memory>
26 #endif
27
28
29 #ifndef CDS_DEFAULT_ALIGNED_ALLOCATOR
30
31     /** \def CDS_DEFAULT_ALIGNED_ALLOCATOR
32         The macro defines aligned allocator implementation.
33
34         The default is \ref cds::OS::aligned_allocator "cds::OS::aligned_allocator<int>".
35         The library uses the <tt> cds::OS::aligned_allocator<int>::rebind<Q>::other </tt> to redefine allocator's type \p int to proper type \p Q.
36     */
37 #define CDS_DEFAULT_ALIGNED_ALLOCATOR    cds::OS::aligned_allocator<int>
38
39 #   include <cds/os/alloc_aligned.h>
40 #endif
41
42 #endif // #ifndef CDSLIB_USER_SETUP_ALLOCATOR_H