Documentation of CSL
allocator.h
Go to the documentation of this file.
1 // This file is part of MARTY.
2 //
3 // MARTY is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // MARTY is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with MARTY. If not, see <https://www.gnu.org/licenses/>.
15 
23 #ifndef ALLOCATOR_H_INCLUDED
24 #define ALLOCATOR_H_INCLUDED
25 
26 #include <memory>
27 #include "memory_pool.h"
28 
29 namespace csl {
30 
31  template<class T, csl::allocator<T>& pool, class ...Args>
32  inline std::shared_ptr<T> make_shared(
33  Args&& ...args) {
34  return std::allocate_shared<T, csl::allocator<T>>(
35  pool, std::forward<Args>(args)...);
36  }
37 
38  template<class T, class ...Args>
39  inline std::shared_ptr<T> make_shared(
40  Args&& ...args) {
41  return std::make_shared<T>(std::forward<Args>(args)...);
42  }
43 }
44 
45 #endif
Namespace for csl library.
Definition: abreviation.h:34
Definition: diagonalization.h:34