cpp_binder, a not-yet-useful tool for generating C++ bindings

ZombineDev via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Sep 21 03:24:31 PDT 2015


On Monday, 21 September 2015 at 09:59:44 UTC, ZombineDev wrote:
> On Monday, 21 September 2015 at 09:45:01 UTC, ZombineDev wrote:
>> [...]
>
> Another option is to introduce a special built-in function like 
> std::move that just selects the rvalue overload. This would 
> require a language change, but would save us from adding && 
> type qualifiers (which is a far more invasive change with 
> little benefit) and would not be complicated to implement in 
> the compiler. For example:
>
> auto my_vec = stdcpp.vector.vector!(stdcpp.thread.thread);
> my_vec.push_back(__cpp_move(stdcpp.thread.thread(&threadFunc)));
> //                 ^--- selects the correct && overload

However we would also need a way to mark a declaration as an 
rvalue overload. Perhaps it can be as simple as:

// D:
extern(C++, namespace, rvalue_params(1, 2))
void fun(const ref T, ref T, ref T, T);

// C++
void fun(const T&, T&&, T&&, T);


More information about the Digitalmars-d-announce mailing list