mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
function-pointer instead of std::function, no unique-ptr around type_register
This commit is contained in:
parent
8362349bb8
commit
fda7cfa2bc
@ -10,24 +10,24 @@
|
||||
namespace ngcore
|
||||
{
|
||||
// clang-tidy should ignore this static object
|
||||
static std::unique_ptr<std::map<std::string, detail::ClassArchiveInfo>> type_register; // NOLINT
|
||||
static std::map<std::string, detail::ClassArchiveInfo> type_register; // NOLINT
|
||||
const detail::ClassArchiveInfo& Archive :: GetArchiveRegister(const std::string& classname)
|
||||
{
|
||||
if(type_register == nullptr) type_register =
|
||||
std::make_unique<std::map<std::string, detail::ClassArchiveInfo>>();
|
||||
return (*type_register)[classname];
|
||||
// if(type_register == nullptr) type_register =
|
||||
// std::make_unique<std::map<std::string, detail::ClassArchiveInfo>>();
|
||||
return (type_register)[classname];
|
||||
}
|
||||
void Archive :: SetArchiveRegister(const std::string& classname, const detail::ClassArchiveInfo& info)
|
||||
{
|
||||
if(type_register == nullptr) type_register =
|
||||
std::make_unique<std::map<std::string, detail::ClassArchiveInfo>>();
|
||||
(*type_register)[classname] = info;
|
||||
// if(type_register == nullptr) type_register =
|
||||
// std::make_unique<std::map<std::string, detail::ClassArchiveInfo>>();
|
||||
(type_register)[classname] = info;
|
||||
}
|
||||
bool Archive :: IsRegistered(const std::string& classname)
|
||||
{
|
||||
if(type_register == nullptr) type_register =
|
||||
std::make_unique<std::map<std::string, detail::ClassArchiveInfo>>();
|
||||
return type_register->count(classname) != 0;
|
||||
// if(type_register == nullptr) type_register =
|
||||
// std::make_unique<std::map<std::string, detail::ClassArchiveInfo>>();
|
||||
return type_register.count(classname) != 0;
|
||||
}
|
||||
|
||||
#ifdef NETGEN_PYTHON
|
||||
|
@ -150,7 +150,8 @@ namespace ngcore
|
||||
void* (*downcaster)(const std::type_info&, void*);
|
||||
|
||||
// Archive constructor arguments
|
||||
std::function<void(Archive&, void*)> cargs_archiver;
|
||||
// std::function<void(Archive&, void*)> cargs_archiver;
|
||||
void (*cargs_archiver)(Archive&, void*);
|
||||
|
||||
#ifdef NETGEN_PYTHON
|
||||
// std::function<pybind11::object(const std::any&)> anyToPyCaster;
|
||||
|
Loading…
Reference in New Issue
Block a user