input/InputStream: allow emplacing the URI

This commit is contained in:
Max Kellermann 2023-01-23 14:02:52 +01:00
parent cd2aaac0c2
commit 5ca74acd8d
2 changed files with 8 additions and 6 deletions

View File

@ -33,10 +33,11 @@ class FailingInputStream final : public InputStream {
const std::exception_ptr error;
public:
explicit FailingInputStream(const char *_uri,
template<typename U>
explicit FailingInputStream(U &&_uri,
const std::exception_ptr _error,
Mutex &_mutex) noexcept
:InputStream(_uri, _mutex), error(_error) {
:InputStream(std::forward<U>(_uri), _mutex), error(_error) {
SetReady();
}

View File

@ -94,10 +94,11 @@ private:
std::string mime;
public:
InputStream(const char *_uri, Mutex &_mutex) noexcept
:uri(_uri),
mutex(_mutex) {
assert(_uri != nullptr);
template<typename U>
InputStream(U &&_uri, Mutex &_mutex) noexcept
:uri(std::forward<U>(_uri)),
mutex(_mutex)
{
}
/**