Created
April 7, 2021 16:25
-
-
Save Beyarz/d73b62a4cd609e54444fb1d43f26b882 to your computer and use it in GitHub Desktop.
at_compile_time.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() | |
{ | |
import std.algorithm, std.conv, std.stdio; | |
"Starting program".writeln; | |
// Sort a constant declaration at Compile-Time | |
enum a = [ 3, 1, 2, 4, 0 ]; | |
static immutable b = sort(a); | |
// Print the result _during_ compilation | |
pragma(msg, text("Finished compilation: ", b)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment