alpaqa
1.0.0a9
Nonconvex constrained optimization
Loading...
Searching...
No Matches
src
alpaqa
include
alpaqa
util
alloc-check.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <Eigen/Core>
4
5
namespace
alpaqa
{
6
7
#ifdef EIGEN_RUNTIME_NO_MALLOC
8
template
<
bool
Allow>
9
struct
ScopedMallocChecker {
10
ScopedMallocChecker() : prev(Eigen::internal::is_malloc_allowed()) {
11
Eigen::internal::set_is_malloc_allowed(Allow);
12
}
13
~ScopedMallocChecker() { Eigen::internal::set_is_malloc_allowed(prev); }
14
bool
prev;
15
};
16
#else
17
template
<
bool
>
18
struct
[[maybe_unused]]
ScopedMallocChecker
{};
19
#endif
20
struct
[[maybe_unused]]
ScopedMallocBlocker
:
ScopedMallocChecker
<false> {};
21
struct
[[maybe_unused]]
ScopedMallocAllower
:
ScopedMallocChecker
<true> {};
22
23
}
// namespace alpaqa
alpaqa
Definition:
anderson.hpp:10
alpaqa::ScopedMallocChecker
Definition:
alloc-check.hpp:18
alpaqa::ScopedMallocAllower
Definition:
alloc-check.hpp:21
alpaqa::ScopedMallocBlocker
Definition:
alloc-check.hpp:20
Generated by
1.9.6