GrPPI  1.0
Generic and Reusable Parallel Pattern Interface
fastflow_allocator.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Universidad Carlos III de Madrid
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef GRPPI_FF_DETAIL_FASTFLOW_ALLOCATOR_H
17 #define GRPPI_FF_DETAIL_FASTFLOW_ALLOCATOR_H
18 
19 #include <ff/allocator.hpp>
20 
21 namespace grppi {
22 
23 namespace detail_ff {
24 
30 struct ff_arena_t {};
31 
36 constexpr ff_arena_t ff_arena;
37 
38 
39 } // namespace detail_ff
40 
41 } // namespace grppi
42 
48 inline void * operator new(
49  std::size_t sz,
50  const grppi::detail_ff::ff_arena_t &) noexcept
51 {
52  return ::ff::ff_malloc(sz);
53 }
54 
60 inline void operator delete(
61  void * ptr,
62  const grppi::detail_ff::ff_arena_t &) noexcept
63 {
64  ::ff::ff_free(ptr);
65 }
66 
67 #endif
constexpr ff_arena_t ff_arena
Fastflow arena object. This object will be passed to placement new/delete to use FastFlow allocation ...
Definition: fastflow_allocator.h:36
Definition: callable_traits.h:21
Tag type for fastflow allocation. This empty type is used to select the overloaded placement new and ...
Definition: fastflow_allocator.h:30