summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorNathan Sashihara <21227491+n8sh@users.noreply.github.com>2018-11-05 16:29:42 -0500
committerNathan Sashihara <21227491+n8sh@users.noreply.github.com>2018-11-05 16:40:48 -0500
commit65e2e344dfa0f676ac5a84d74b03b46e74b76eaa (patch)
treefcc102439ca08069dd99478c92c1d3dfa656eb7a /source
parent184d307e40832c1c69c14729a3dc7d559614abc1 (diff)
downloadtanya-65e2e344dfa0f676ac5a84d74b03b46e74b76eaa.tar.gz
Use inout in tanya.range.array functions
This is to reduce distinct generated functions in final executable. Also add `scope` and `return` to function parameters.
Diffstat (limited to 'source')
-rw-r--r--source/tanya/range/array.d12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/tanya/range/array.d b/source/tanya/range/array.d
index 3cf68dc..97101b9 100644
--- a/source/tanya/range/array.d
+++ b/source/tanya/range/array.d
@@ -54,7 +54,7 @@ module tanya.range.array;
*
* Precondition: $(D_INLINECODE array.length > 0).
*/
-@property ref T front(T)(T[] array)
+@property ref inout(T) front(T)(return scope inout(T)[] array)
in
{
assert(array.length > 0);
@@ -94,7 +94,7 @@ do
*
* Precondition: $(D_INLINECODE array.length > 0).
*/
-@property ref T back(T)(T[] array)
+@property ref inout(T) back(T)(return scope inout(T)[] array)
in
{
assert(array.length > 0);
@@ -133,7 +133,7 @@ do
*
* Precondition: $(D_INLINECODE array.length > 0).
*/
-void popFront(T)(ref T[] array)
+void popFront(T)(scope ref inout(T)[] array)
in
{
assert(array.length > 0);
@@ -144,7 +144,7 @@ do
}
/// ditto
-void popBack(T)(ref T[] array)
+void popBack(T)(scope ref inout(T)[] array)
in
{
assert(array.length > 0);
@@ -178,7 +178,7 @@ do
* Returns: $(D_KEYWORD true) if $(D_PARAM array) has no elements,
* $(D_KEYWORD false) otherwise.
*/
-@property bool empty(T)(const T[] array)
+@property bool empty(T)(scope const T[] array)
{
return array.length == 0;
}
@@ -203,7 +203,7 @@ do
*
* Returns: A copy of the slice $(D_PARAM array).
*/
-@property T[] save(T)(T[] array)
+@property inout(T)[] save(T)(return scope inout(T)[] array)
{
return array;
}