From bce4d934a47023096e74ac39ed4d3a2cd99bc8e4 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 15 Apr 2017 14:21:20 +0200 Subject: Abstract stack prepending --- source/base/stack.d | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source/base') diff --git a/source/base/stack.d b/source/base/stack.d index e42ff12..c6e1a59 100644 --- a/source/base/stack.d +++ b/source/base/stack.d @@ -32,13 +32,17 @@ Token pop(ref Stack!Token stack) { return token; } -void push(ref Stack!Token stack, Token token) { - stack.insertFront(token); -} - template push(T) if ( is(T == int) || is(T == bool) || is (T == string) ) { void push(ref Stack!Token stack, T value) { stack.push(Token(value)); } } + +void push(ref Stack!Token stack, Token token) { + stack.insertFront(token); +} + +void push(ref Stack!Token stack, Stack!Token prefix) { + stack.insertFront(prefix[]); +} -- cgit v1.2.3