diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-12-26 12:40:37 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-01-03 18:37:59 +0100 |
commit | fa39cdd072c91eac70cda04b8b26681611f94cb7 (patch) | |
tree | d55df8a3ca432f25a970b5ef6f90bef37e29fa53 /src | |
parent | 2dab2d239a4777b5ffd59a94a8eebd8638644e6c (diff) |
refactor: Use C++17 std::array deduction for OUTPUT_TYPES
Diffstat (limited to 'src')
-rw-r--r-- | src/outputtype.cpp | 2 | ||||
-rw-r--r-- | src/outputtype.h | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/outputtype.cpp b/src/outputtype.cpp index e978852826..d96fb282c5 100644 --- a/src/outputtype.cpp +++ b/src/outputtype.cpp @@ -19,8 +19,6 @@ static const std::string OUTPUT_TYPE_STRING_LEGACY = "legacy"; static const std::string OUTPUT_TYPE_STRING_P2SH_SEGWIT = "p2sh-segwit"; static const std::string OUTPUT_TYPE_STRING_BECH32 = "bech32"; -const std::array<OutputType, 3> OUTPUT_TYPES = {OutputType::LEGACY, OutputType::P2SH_SEGWIT, OutputType::BECH32}; - bool ParseOutputType(const std::string& type, OutputType& output_type) { if (type == OUTPUT_TYPE_STRING_LEGACY) { diff --git a/src/outputtype.h b/src/outputtype.h index 57316b92d6..88422e5824 100644 --- a/src/outputtype.h +++ b/src/outputtype.h @@ -20,7 +20,11 @@ enum class OutputType { BECH32, }; -extern const std::array<OutputType, 3> OUTPUT_TYPES; +static constexpr auto OUTPUT_TYPES = std::array{ + OutputType::LEGACY, + OutputType::P2SH_SEGWIT, + OutputType::BECH32, +}; [[nodiscard]] bool ParseOutputType(const std::string& str, OutputType& output_type); const std::string& FormatOutputType(OutputType type); |