// Matrix Construct // // Copyright (C) Matrix Construct Developers, Authors & Contributors // Copyright (C) 2016-2018 Jason Volk // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice is present in all copies. The // full license for this software is available in the LICENSE file. #pragma once #define HAVE_IRCD_MODS_IMPORT_SHARED_H namespace ircd::mods { template struct import_shared; } /// Convenience for importing an std::shared_ptr from a loaded lib /// template struct ircd::mods::import_shared :import> ,std::shared_ptr { using std::shared_ptr::get; using std::shared_ptr::operator bool; using std::shared_ptr::operator->; using std::shared_ptr::operator*; operator const T &() const { return std::shared_ptr::operator*(); } operator T &() { return std::shared_ptr::operator*(); } import_shared() = default; import_shared(module, const string_view &symname); import_shared(const string_view &modname, const string_view &symname); }; template ircd::mods::import_shared::import_shared(const string_view &modname, const string_view &symname) :import_shared { module(modname), symname } {} template ircd::mods::import_shared::import_shared(module module, const string_view &symname) :import> { module, symname } ,std::shared_ptr { import>::operator*() }{}