Skip to content

StdVector of Tuple #469

@grasph

Description

@grasph

Hello Bart,

I get a compilation error if I try to call apply_stl for a tuple. Code to reproduce the issue and the resulting error follow. Any idea, how this could be fixed?

Code

#include "jlcxx/jlcxx.hpp"
#include "jlcxx/stl.hpp"

JLCXX_MODULE define_julia_module(jlcxx::Module& mod)
{
  jlcxx::stl::apply_stl<std::tuple<double, double>>(mod);
}

Error

In file included from ~/.julia/artifacts/d379d731f869ddcffe30d14534f721b657420132/include/jlcxx/jlcxx.hpp:14,
                 from ~/dev/julia/cxxwrap_vector_of_tuple/vecoftuples.cxx:1:
~/.julia/artifacts/d379d731f869ddcffe30d14534f721b657420132/include/jlcxx/array.hpp: In instantiation of ‘ValueT& jlcxx::ArrayRef::operator[](std::size_t) [with ValueT = std::tuple; int Dim = 1; std::size_t = long unsigned int]’:
~/.julia/artifacts/d379d731f869ddcffe30d14534f721b657420132/include/jlcxx/stl.hpp:161:24:   required from ‘void jlcxx::stl::WrapVector::operator()(TypeWrapperT&&) [with TypeWrapperT = jlcxx::TypeWrapper, std::allocator > > >]’
~/.julia/artifacts/d379d731f869ddcffe30d14534f721b657420132/include/jlcxx/module.hpp:1225:15:   required from ‘int jlcxx::TypeWrapper::apply_internal(FunctorT&&) [with AppliedT = std::vector, std::allocator > >; FunctorT = jlcxx::stl::WrapVector; T = jlcxx::Parametric >]’
~/.julia/artifacts/d379d731f869ddcffe30d14534f721b657420132/include/jlcxx/module.hpp:1174:63:   required from ‘jlcxx::TypeWrapper& jlcxx::TypeWrapper::apply(FunctorT&&) [with AppliedTypesT = {std::vector, std::allocator > >}; FunctorT = jlcxx::stl::WrapVector; T = jlcxx::Parametric >]’
~/.julia/artifacts/d379d731f869ddcffe30d14534f721b657420132/include/jlcxx/stl.hpp:379:74:   required from ‘void jlcxx::stl::apply_stl(jlcxx::Module&) [with T = std::tuple]’
~/dev/julia/cxxwrap_vector_of_tuple/vecoftuples.cxx:6:52:   required from here
~/.julia/artifacts/d379d731f869ddcffe30d14534f721b657420132/include/jlcxx/array.hpp:257:52: error: invalid initialization of reference of type ‘const jlcxx::WrappedCppPtr&’ from expression of type ‘jlcxx::ArrayRef, 1>::julia_t’ {aka ‘_jl_value_t*’}
  257 |       return *extract_pointer_nonull(data()[i]);
      |                                      ~~~~~~^
In file included from ~/.julia/artifacts/d379d731f869ddcffe30d14534f721b657420132/include/jlcxx/array.hpp:4:
~/.julia/artifacts/d379d731f869ddcffe30d14534f721b657420132/include/jlcxx/type_conversion.hpp:186:58: note: in passing argument 1 of ‘CppT* jlcxx::extract_pointer_nonull(const WrappedCppPtr&) [with CppT = std::tuple]’
  186 | inline CppT* extract_pointer_nonull(const WrappedCppPtr& p)
      |                                     ~~~~~~~~~~~~~~~~~~~~~^

Thanks in advance for your help,

Philippe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions