# Passing an array of tuples to CxxWrap

**URL:** <https://discourse.julialang.org/t/passing-an-array-of-tuples-to-cxxwrap/125392>\
**Category:** General Usage\
**Tags:** cxx, cxxwrap\
**Created:** [January 30, 2025, 1:49pm UTC](https://discourse.julialang.org/t/passing-an-array-of-tuples-to-cxxwrap/125392 "2025-01-30T13:49:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nabla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nabla/32/26089_2.png) [@nabla](https://discourse.julialang.org/u/nabla)\
**Post date:** [January 30, 2025, 1:49pm UTC](https://discourse.julialang.org/t/passing-an-array-of-tuples-to-cxxwrap/125392/1 "2025-01-30T13:49:32Z")

</div>

I’d love to pass an array of tuples to some C++ code; say calling

```julia
myfunction([("a",1),("b",2)])

```

At the C++ level, I would write a function

```C++
mod.method("myfunction", [](const jlcxx::ArrayRef<std::tuple<std::string,int>> &arg) {...});

```

(I also tried with `std::vector` rather than `ArrayRef`’, and `std::pair` instead of `std::tuple` too). However, I always get an error on loading,  
`C++ exception while wrapping module XXX: No appropriate factory for type NSt3__14pairINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEjEE`

Is there a way to do this without creating a special type, or passing two lists (one of strings, one of ints), with zipping and unzipping to create the arguments?
