dmlc / ps-lite

A lightweight parameter server interface

Home Page:http://ps-lite.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why using template function for GetEnv?

microwish opened this issue · comments

include/ps/internal/utils.h:

29 template
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.