Commit 1d6d1c97f05e0dc50eefaf3b4d84872f96eed1ac
1 parent
38b4b1be
clean up standard_value class a bit
This removes the `final` on the class, and the `virtual` keyword on the functions that made `final` necessary. They shouldn't have been virtual in the first place since nothing derives from it. This hopefully doesn't reintroduce the non-virtual-destructor warning.
Showing
1 changed file
with
10 additions
and
6 deletions
include/cxxopts.hpp
| @@ -692,7 +692,7 @@ namespace cxxopts | @@ -692,7 +692,7 @@ namespace cxxopts | ||
| 692 | }; | 692 | }; |
| 693 | 693 | ||
| 694 | template <typename T> | 694 | template <typename T> |
| 695 | - class standard_value final : public Value | 695 | + class standard_value : public Value |
| 696 | { | 696 | { |
| 697 | public: | 697 | public: |
| 698 | standard_value() | 698 | standard_value() |
| @@ -742,15 +742,17 @@ namespace cxxopts | @@ -742,15 +742,17 @@ namespace cxxopts | ||
| 742 | return m_implicit; | 742 | return m_implicit; |
| 743 | } | 743 | } |
| 744 | 744 | ||
| 745 | - virtual std::shared_ptr<Value> | ||
| 746 | - default_value(const std::string& value){ | 745 | + std::shared_ptr<Value> |
| 746 | + default_value(const std::string& value) | ||
| 747 | + { | ||
| 747 | m_default = true; | 748 | m_default = true; |
| 748 | m_default_value = value; | 749 | m_default_value = value; |
| 749 | return shared_from_this(); | 750 | return shared_from_this(); |
| 750 | } | 751 | } |
| 751 | 752 | ||
| 752 | - virtual std::shared_ptr<Value> | ||
| 753 | - implicit_value(const std::string& value){ | 753 | + std::shared_ptr<Value> |
| 754 | + implicit_value(const std::string& value) | ||
| 755 | + { | ||
| 754 | m_implicit = true; | 756 | m_implicit = true; |
| 755 | m_implicit_value = value; | 757 | m_implicit_value = value; |
| 756 | return shared_from_this(); | 758 | return shared_from_this(); |
| @@ -784,9 +786,11 @@ namespace cxxopts | @@ -784,9 +786,11 @@ namespace cxxopts | ||
| 784 | protected: | 786 | protected: |
| 785 | std::shared_ptr<T> m_result; | 787 | std::shared_ptr<T> m_result; |
| 786 | T* m_store; | 788 | T* m_store; |
| 789 | + | ||
| 787 | bool m_default = false; | 790 | bool m_default = false; |
| 788 | - std::string m_default_value; | ||
| 789 | bool m_implicit = false; | 791 | bool m_implicit = false; |
| 792 | + | ||
| 793 | + std::string m_default_value; | ||
| 790 | std::string m_implicit_value; | 794 | std::string m_implicit_value; |
| 791 | }; | 795 | }; |
| 792 | } | 796 | } |