Closed bbartman closed 3 years ago
Code:
<# Defining implicit utility function, macros, and builtins. #>; __throw_bad_alloc()<noreturn>:void __STDCPP_DEFAULT_NEW_ALIGNMENT__<constexpr>:int = 8 addressof[T:type](x:ref T)<inline>:^T ! return __builtin_addressof(x) <# Defining Remove reference for perfect forwarding. #>; remove_reference[T:type] = class { ty : type = T; } remove_reference[T:type][ref T] = class { ty : type = T; } remove_reference[T:type][rref T] = class { ty : type = T; } <# Defining forwarding function. #>; forward[T:type](t:ref remove_reference[T].ty)<constexpr>:rref T !{ return static_cast[rref T](t); } forward[T:type](t:rref remove_reference[T].ty)<constexpr>:rref T !{ return static_cast[rref remove_reference[T].ty](t); } move[T:type](t:rref T)<noexcept><constexpr>:rref remove_reference<T>.ty! { return static_cast[rref remove_reference[T].ty](t); } foo[T:type, Args:type...](x:^type, args:rrerf Args...):void! { x.construct(forward[Args](args...)); } main():int !{ subject:vector[int]; return 0; }```
Code: