archive/zzip: pass std::shared_ptr as template parameter
This eliminates a tiny amount of overhead because the compiler can choose how to pass the parameter.
This commit is contained in:
parent
c53074efc9
commit
9d910320f3
@ -54,8 +54,9 @@ class ZzipArchiveFile final : public ArchiveFile {
|
|||||||
std::shared_ptr<ZzipDir> dir;
|
std::shared_ptr<ZzipDir> dir;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ZzipArchiveFile(std::shared_ptr<ZzipDir> &&_dir) noexcept
|
template<typename D>
|
||||||
:dir(std::move(_dir)) {}
|
explicit ZzipArchiveFile(D &&_dir) noexcept
|
||||||
|
:dir(std::forward<D>(_dir)) {}
|
||||||
|
|
||||||
virtual void Visit(ArchiveVisitor &visitor) override;
|
virtual void Visit(ArchiveVisitor &visitor) override;
|
||||||
|
|
||||||
@ -91,11 +92,12 @@ class ZzipInputStream final : public InputStream {
|
|||||||
ZZIP_FILE *const file;
|
ZZIP_FILE *const file;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ZzipInputStream(const std::shared_ptr<ZzipDir> _dir, const char *_uri,
|
template<typename D>
|
||||||
|
ZzipInputStream(D &&_dir, const char *_uri,
|
||||||
Mutex &_mutex,
|
Mutex &_mutex,
|
||||||
ZZIP_FILE *_file)
|
ZZIP_FILE *_file)
|
||||||
:InputStream(_uri, _mutex),
|
:InputStream(_uri, _mutex),
|
||||||
dir(_dir), file(_file) {
|
dir(std::forward<D>(_dir)), file(_file) {
|
||||||
//we are seekable (but its not recommendent to do so)
|
//we are seekable (but its not recommendent to do so)
|
||||||
seekable = true;
|
seekable = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user