Created
May 7, 2015 12:40
-
-
Save weberc2/4131654ff068d27f9cde to your computer and use it in GitHub Desktop.
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
public bool string_compare(string a, string b) { | |
return a == b; | |
} | |
public bool template_compare<T>(T a, T b) { | |
return a == b; | |
} | |
public string bool_to_str(bool val) { | |
return val ? "true" : "false"; | |
} | |
public void main() { | |
string a = "abcd"; | |
string b = "abcd"; | |
// compare strings with string_compare | |
string string_compare_result = bool_to_str(string_compare(a, b)); | |
stdout.printf("string_compare(%s, %s): %s\n", a, b, string_compare_result); | |
// compare strings with template_compare | |
string template_compare_result = bool_to_str(template_compare<string>(a, b)); | |
stdout.printf("template_compare(%s, %s): %s\n", a, b, template_compare_result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment