Skip to content

Commit

Permalink
improve definition of resource
Browse files Browse the repository at this point in the history
  • Loading branch information
jingkaimori committed Apr 14, 2024
1 parent 11a45be commit a03dece
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
19 changes: 8 additions & 11 deletions Kernel/Abstractions/resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ template <class R> class resource_ptr {
~resource_ptr (){};

public:
R* rep;
static hashmap<string, pointer> instances;
inline R* operator->() { return rep; }
R* rep;
inline static hashmap<string, pointer> instances=
hashmap<string, pointer> (NULL); // C++17 feature
inline R* operator->() { return rep; }
};

#if (defined(_WIN32) || defined(_WIN64))
Expand All @@ -51,14 +52,10 @@ template <class R> class resource_ptr {
}
#endif

#if (defined(_WIN32) || defined(_WIN64))
#define RESOURCE_CODE(PTR) \
hashmap<string, pointer> resource_ptr<PTR##_rep>::instances (NULL);
#else
#define RESOURCE_CODE(PTR) \
template <> \
hashmap<string, pointer> resource_ptr<PTR##_rep>::instances (NULL);
#endif
/**
* @deprecated
*/
#define RESOURCE_CODE(PTR)

template <class R>
inline bool
Expand Down
1 change: 0 additions & 1 deletion lolly/system/shared_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ load_shared_library (string name, url path) {

} // namespace system
} // namespace lolly
RESOURCE_CODE (lolly::system::shared_lib);
#endif

0 comments on commit a03dece

Please sign in to comment.