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);
//                 ^--- 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);

Reply via email to