From 3f1b431ee2498a4d0a207a3426192f43f22f7fa4 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Fri, 15 Dec 2017 21:39:23 +0900 Subject: [PATCH] add missing `inline` specifier #7 --- toml/parser.hpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/toml/parser.hpp b/toml/parser.hpp index 10cc683..628498b 100644 --- a/toml/parser.hpp +++ b/toml/parser.hpp @@ -1102,12 +1102,28 @@ toml::Table parse(std::basic_istream& is) } } -toml::Table parse(const std::string& filename) +inline toml::Table parse(const char* filename) { std::ifstream ifs(filename, std::ios_base::in | std::ios_base::binary); - if(!ifs.good()) throw std::runtime_error("file open error: " + filename); + if(!ifs.good()) + { + throw std::runtime_error("file open error: " + std::string(filename)); + } return parse(ifs); } +template> +inline toml::Table parse(const std::basic_string& filename) +{ + std::ifstream ifs(filename, std::ios_base::in | std::ios_base::binary); + if(!ifs.good()) + { + throw std::runtime_error("file open error: " + filename); + } + return parse(ifs); +} + + + }// toml #endif// TOML11_PARSER