X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/4271ab433cd55bbd2612292bcf39e4dc3d7274f1..0907aa4037b12b6b88ee24495d4577a064d4f8db:/sgconf/utils.h diff --git a/sgconf/utils.h b/sgconf/utils.h deleted file mode 100644 index 6168cbf2..00000000 --- a/sgconf/utils.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include "stg/common.h" -#include "stg/optional.h" - -#include -#include - -namespace SGCONF -{ - -template -inline -void MaybeSet(const std::map & options, const std::string & name, STG::Optional & res) -{ -std::map::const_iterator it(options.find(name)); -if (it == options.end()) - return; -T value; -if (str2x(it->second, value) < 0) - return; -res = value; -} - -template -inline -void MaybeSet(const std::map & options, const std::string & name, T & res, F conv) -{ -std::map::const_iterator it(options.find(name)); -if (it == options.end()) - return; -conv(it->second, res); -} - -template <> -inline -void MaybeSet(const std::map & options, const std::string & name, STG::Optional & res) -{ -std::map::const_iterator it(options.find(name)); -if (it == options.end()) - return; -res = it->second; -} - -} // namespace SGCONF