-/* Copyright (c) 2015-2019. The SimGrid Team.
+/* Copyright (c) 2015-2020. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
template<class T, class U>
class Extension {
- static const std::size_t INVALID_ID = std::numeric_limits<std::size_t>::max();
- std::size_t id_ = INVALID_ID;
+ static constexpr std::size_t INVALID_ID = std::numeric_limits<std::size_t>::max();
+ std::size_t id_ = INVALID_ID;
friend class Extendable<T>;
explicit constexpr Extension(std::size_t id) : id_(id) {}
public:
class Extendable {
private:
static std::vector<void(*)(void*)> deleters_;
- std::vector<void*> extensions_;
+ std::vector<void*> extensions_{(deleters_.size() > 0 ? deleters_.size() : 1), nullptr};
+
public:
static size_t extension_create(void (*deleter)(void*))
{
{
return Extension<T, U>(extension_create([](void* p) { delete static_cast<U*>(p); }));
}
- Extendable() : extensions_((deleters_.size() > 0 ? deleters_.size() : 1), nullptr) {}
+ Extendable() {}
Extendable(const Extendable&) = delete;
Extendable& operator=(const Extendable&) = delete;
~Extendable()