From 2f5ecd46c7399147ca8868bfda4a92354364f32a Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 18 Aug 2014 22:09:57 +1000 Subject: [PATCH] options: move bool value getter into cpp Keeping the bool valueoption getter in the header was causing duplicate definitions in the built static library. --- options.cpp | 20 ++++++++++++++++++++ options.hpp | 17 ----------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/options.cpp b/options.cpp index de113c89..652ac6c9 100644 --- a/options.cpp +++ b/options.cpp @@ -127,6 +127,26 @@ presentoption::execute (void) { } +/* + * Value option + */ + +namespace util { + template<> + bool& + valueoption::get_arg(const std::string& arg, bool *val) { + if (arg == "true" || arg == "yes" || arg == "1") + *val = true; + else if (arg == "false" || arg == "no" || arg == "0") + *val = false; + else + throw std::domain_error("Invalid form for boolean argument"); + + return *val; + } +} + + /* * bytesoption */ diff --git a/options.hpp b/options.hpp index d46d02bc..10c82a68 100644 --- a/options.hpp +++ b/options.hpp @@ -192,23 +192,6 @@ namespace util { }; - // God-damn Solaris strikes again with its antiquated everything. So you - // don't get these goodies on that system, with its ancient compiler. -#if __GNUC__ >= 4 - template<> - bool& valueoption::get_arg(const std::string& arg, bool * val) { - if (arg == "true" || arg == "yes" || arg == "1") - *val = true; - else if (arg == "false" || arg == "no" || arg == "0") - *val = false; - else - throw std::domain_error("Invalid form for boolean argument"); - - return *val; - } -#endif - - /** * Interpret a (possibly) numeric value as a data size. *