Skip to content

Commit 7af44aa

Browse files
committed
Document DefaultConstructible and CopyConstructible
1 parent 7d07332 commit 7af44aa

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,14 @@ To write a C++ function that returns a new object that can be garbage-collected
416416
jlcxx::create<Class>(constructor_arg1, ...);
417417
```
418418

419-
This will return the new C++ object wrapped in a `jl_value_t*` that has a finalizer.
419+
This will return the new C++ object wrapped in a `jl_value_t*` that has a
420+
finalizer. The default constructor can be explicitly disabled by specializing
421+
the `DefaultConstructible` type trait, for example:
422+
```c++
423+
namespace jlcxx {
424+
template<> struct DefaultConstructible<Class> : std::false_type { };
425+
}
426+
```
420427
421428
### Copy constructor
422429
@@ -427,6 +434,14 @@ wvec = cpp_function_returning_vector()
427434
julia_array = copy.(wvec)
428435
```
429436

437+
It can be explicitly disabled for a type by specializing the `CopyConstructible`
438+
type trait, for example:
439+
```c++
440+
namespace jlcxx {
441+
template<> struct CopyConstructible<Class> : std::false_type { };
442+
}
443+
```
444+
430445
### Return values
431446
If a wrapped C++ function returns an object by value, the wrapped object gets a finalizer
432447
and is owned by Julia. The same holds if a smart pointer such as `shared_ptr` (automatically

0 commit comments

Comments
 (0)