Skip to content

Commit 0e5a916

Browse files
committed
clbind: disambiguate apply_and_return on std::unique_ptr
Previously, returning a std::unique_ptr from a clbound function would complain about ambiguous partial specializations of apply_and_return, the other one being include/clasp/clbind/apply.h:51.
1 parent 5c1e91f commit 0e5a916

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

include/clasp/clbind/apply.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,18 @@ template <typename... Policies, typename Func, typename Tuple> struct apply_and_
9393
};
9494

9595
// clbind apply_and_return - this needs to handle multiple-values
96-
template <typename... Policies, typename RT, typename Func, typename Tuple>
97-
struct apply_and_return<policies<Policies...>, std::unique_ptr<RT>, Func, Tuple> {
98-
static gc::return_type go(Func&& fn, Tuple&& tuple) {
96+
template <typename... Policies, typename RT, typename Func, typename... Args>
97+
struct apply_and_return<policies<Policies...>, std::unique_ptr<RT>, Func, std::tuple<Args...>> {
98+
using tuple_type = std::tuple<Args...>;
99+
static gc::return_type go(Func&& fn, tuple_type&& tuple) {
99100
std::unique_ptr<RT> retval = clbind::apply(std::move(fn), std::move(tuple));
100101
core::MultipleValues& returnValues = core::lisp_multipleValues();
101102
returnValues.setSize(0);
102103
// When returning unique_ptr always adopt it
103-
core::T_sp rv = translate::to_object<std::unique_ptr<RT>, translate::adopt_pointer>::convert(std::move(retval));
104+
core::T_sp rv = translate::to_object<std::unique_ptr<RT>, translate::adopt_pointer>::convert(retval);
104105
returnValues.emplace_back(rv);
105-
tuple.write_multiple_values(returnValues);
106+
printf("%s:%d Write the multiple values in tuple here\n", __FILE__, __LINE__);
107+
//tuple.write_multiple_values(returnValues);
106108
return LCC_RETURN(rv.raw_(), returnValues.getSize());
107109
}
108110
};

0 commit comments

Comments
 (0)