X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e080adacaf1ba847ad467f5b8d21da385636ed3c..238ba443a8fb93bf6a0d5e14265a93f443b1adab:/include/xbt/Extendable.hpp diff --git a/include/xbt/Extendable.hpp b/include/xbt/Extendable.hpp index 3c3c86061a..195f287556 100644 --- a/include/xbt/Extendable.hpp +++ b/include/xbt/Extendable.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2020. The SimGrid Team. +/* Copyright (c) 2015-2022. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -7,6 +7,7 @@ #ifndef SIMGRID_XBT_LIB_HPP #define SIMGRID_XBT_LIB_HPP +#include "xbt/base.h" // XBT_ATTRIB_DEPRECATED_v334 #include #include #include @@ -111,7 +112,11 @@ public: void set_data(void* data){ extensions_[0]=data; } - void* get_data() const { return extensions_[0]; } + template D* get_data() const { return static_cast(extensions_[0]); } + XBT_ATTRIB_DEPRECATED_v334("Please use typed template Extendable::get_data<>()") void* get_data() const + { + return get_data(); + } // Convenience extension access when the type has an associated EXTENSION ID: template U* extension() const { return extension(U::EXTENSION_ID); } template void extension_set(U* p) { extension_set(U::EXTENSION_ID, p); }