ps-lite
ps-lite copied to clipboard
Why using template function for GetEnv?
include/ps/internal/utils.h:
29 template<typename V>
30 inline V GetEnv(const char *key, V default_val) {
31 const char *val = Environment::Get()->find(key);
32 if (val == nullptr) {
33 return default_val;
34 } else {
35 return atoi(val);
36 }
37 }
Both the comments of this function and where this function is called indicate the return value is of type int.
So I wonder why you use template.
Thanks.