Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not support multiple data types to return #30

Closed
HW140701 opened this issue Jan 17, 2024 · 2 comments
Closed

not support multiple data types to return #30

HW140701 opened this issue Jan 17, 2024 · 2 comments

Comments

@HW140701
Copy link

HW140701 commented Jan 17, 2024

now only support return std::string,

std::string value = ini.get("section").get("key");

but we want

int value = ini.get("section").get("key").get<int>();

@metayeti
Copy link
Owner

This is by design. To keep the library simple, I've decided early on to only work with std::string. It's not hard to write a wrapper that does what you want.

@MabelYT
Copy link
Contributor

MabelYT commented Jan 17, 2024

Hey @HW140701,
To Get An Int From It, Just Call It Like This:

std::string valueRaw = ini["section"]["key"];
// Handle Invalid Characters Here.
int Value = stoi(valueRaw);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants