Skip to content

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

@YarikTH

Description

@YarikTH

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)};
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions