dmlc / dmlc/ps-lite

Why using template function for GetEnv?

Open
#81 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.6k
Forks
540
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.