Skip to content

Commit 45d673a

Browse files
committed
Merge branch 'master' of https://github.com/milasudril/alice
2 parents e285762 + 87d5d65 commit 45d673a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

commandline.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@ namespace Alice
4444

4545
void help(bool headers_print=0,FILE* dest=stdout) const noexcept;
4646

47+
size_t size() const noexcept
48+
{return m_entry_count;}
49+
4750
private:
4851
OptionMap<OptionDescriptor> m_entries;
4952
Array<Option,countof(OptionDescriptor::options)> m_info;
53+
size_t m_entry_count;
5054

5155
static constexpr Array<Option,countof(OptionDescriptor::options)> make_info()
5256
{
@@ -121,7 +125,7 @@ namespace Alice
121125
template<class OptionDescriptor>
122126
template<class ErrorHandler>
123127
CommandLine<OptionDescriptor>::CommandLine(int argc,const char* const* argv)
124-
:m_info(make_info())
128+
:m_info(make_info()), m_entry_count(0)
125129
{
126130
ErrorHandler eh;
127131
if(argc==0)
@@ -132,7 +136,7 @@ namespace Alice
132136

133137
auto options_loaded=optionsLoad(argc,argv
134138
,KeyChecker< OptionMap<OptionDescriptor>,ErrorHandler >(m_entries,m_info.data,eh));
135-
139+
m_entry_count = options_loaded.size();
136140
m_entries.itemsEnum([&options_loaded](size_t index,Stringkey::HashValue key,auto& x)
137141
{
138142
auto i=options_loaded.find(key);

0 commit comments

Comments
 (0)