Skip to content

Commit 3714583

Browse files
committed
Test boolean reference and bump version to v0.7.2
1 parent 52627ad commit 3714583

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

examples/functions.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,11 @@ JLCXX_MODULE init_test_module(jlcxx::Module& mod)
329329
mod.method("unmark_boxed", [&] () { jlcxx::unprotect_from_gc(marked_value); });
330330

331331
mod.method("open", [] (const std::string& s) { return s; });
332-
}
332+
333+
mod.method("boolref", [] (bool& b)
334+
{
335+
b = !b;
336+
});
337+
}
333338

334339
}

include/jlcxx/jlcxx_config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#define JLCXX_VERSION_MAJOR 0
1717
#define JLCXX_VERSION_MINOR 7
18-
#define JLCXX_VERSION_PATCH 1
18+
#define JLCXX_VERSION_PATCH 2
1919

2020
// From https://stackoverflow.com/questions/5459868/concatenate-int-to-string-using-c-preprocessor
2121
#define __JLCXX_STR_HELPER(x) #x

include/jlcxx/type_conversion.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ inline CppT* extract_pointer_nonull(const WrappedCppPtr& p)
172172
{
173173
if(p.voidptr == nullptr)
174174
{
175-
throw std::runtime_error("C++ object was deleted");
175+
std::stringstream errorstr;
176+
errorstr << "C++ object of type " << typeid(CppT).name() << " was deleted";
177+
throw std::runtime_error(errorstr.str());
176178
}
177179
return extract_pointer<CppT>(p);
178180
}
@@ -667,7 +669,6 @@ BoxedValue<T> julia_owned(T* cpp_ptr)
667669
/// Base class to specialize for conversion to Julia
668670
// C++ wrapped types are in fact always returned as a pointer wrapped in a struct, so to avoid memory management issues with the wrapper itself
669671
// we always return the wrapping struct by value
670-
//template<typename T, typename TraitT=mapping_trait<typename std::remove_pointer<typename std::remove_reference<T>::type>::type>>
671672
template<typename T, typename TraitT=mapping_trait<T>>
672673
struct ConvertToJulia
673674
{

0 commit comments

Comments
 (0)