Skip to content
Discussion options

You must be logged in to vote

The beauty of open source is the answer is right there in the code that we can share and review, in this instance the star of the show is the SharedObjects::share(ref_ptr& object)https://github.com/vsg-dev/VulkanSceneGraph/blob/master/include/vsg/utils/SharedObjects.h#L154 method that leverages a std::map/set combo in SharedObjects, along with vsg::Object::compare():

The ShaderObjects members that store the shared objects:

        mutable std::recursive_mutex _mutex;
        std::map<std::type_index, ref_ptr<Object>> _defaults;
        std::map<std::type_index, std::set<ref_ptr<Object>, DereferenceLess>> _sharedObjects;

The SharedObjects::share(ref_ptr& object) implementation:

template<class

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by xiaoxin0214
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants