diff options
author | Adrian Kummerlaender | 2017-04-15 14:21:20 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2017-04-15 14:21:20 +0200 |
commit | bce4d934a47023096e74ac39ed4d3a2cd99bc8e4 (patch) | |
tree | 729162d54b77b2480293dff657cb59d5ddc7dd5a /source/base | |
parent | 47611c4938363346be414b1cf00a63b438e043c4 (diff) | |
download | slang-bce4d934a47023096e74ac39ed4d3a2cd99bc8e4.tar slang-bce4d934a47023096e74ac39ed4d3a2cd99bc8e4.tar.gz slang-bce4d934a47023096e74ac39ed4d3a2cd99bc8e4.tar.bz2 slang-bce4d934a47023096e74ac39ed4d3a2cd99bc8e4.tar.lz slang-bce4d934a47023096e74ac39ed4d3a2cd99bc8e4.tar.xz slang-bce4d934a47023096e74ac39ed4d3a2cd99bc8e4.tar.zst slang-bce4d934a47023096e74ac39ed4d3a2cd99bc8e4.zip |
Abstract stack prepending
Diffstat (limited to 'source/base')
-rw-r--r-- | source/base/stack.d | 12 |
1 files changed, 8 insertions, 4 deletions
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[]); +} |