tuplet icon indicating copy to clipboard operation
tuplet copied to clipboard

Can't construct tuple<T, U> passing (const T&, const U&) in the constructor

Open YarikTH opened this issue 1 year ago • 2 comments

I tried to use tuplet::tuple as a optional drop-in replacement for std::tuple to check if it reduces compilation times for my use case. But compilation failed. I reproduced it on godbolt.

Any ideas? Is it principal limitation of tuplet so, some wrapper function should be called or it is a bug that can be easily fixed?

#include <memory>

#ifdef USE_STD_TUPLE
#include <tuple>

using std::apply;
using std::tie;
using std::tuple;
#else
#include "https://raw.githubusercontent.com/codeinred/tuplet/main/include/tuplet/tuple.hpp"

using tuplet::apply;
using tuplet::tie;
using tuplet::tuple;
#endif

template <typename... DepValues>
class Foo {
   public:
    Foo(const std::shared_ptr<DepValues>&... deps) : m_deps(deps...) {}

   private:
    using dep_holder_t = tuple<std::shared_ptr<DepValues>...>;

    dep_holder_t m_deps;
};

int main() {
    using T = Foo<int, int>;

    T t{std::make_shared<int>(3), std::make_shared<int>(5)};
}

YarikTH avatar Jan 07 '23 23:01 YarikTH