Skip to content

Commit 110772c

Browse files
ishitatsuyukivprus
authored andcommitted
Simplify vector initialization
1 parent d164a20 commit 110772c

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

include/boost/program_options/detail/parsers.hpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,6 @@
1212

1313
namespace boost { namespace program_options {
1414

15-
namespace detail {
16-
template<class charT, class Iterator>
17-
std::vector<std::basic_string<charT> >
18-
make_vector(Iterator i, Iterator e)
19-
{
20-
std::vector<std::basic_string<charT> > result;
21-
// Some compilers don't have templated constructor for
22-
// vector, so we can't create vector from (argv+1, argv+argc) range
23-
for(; i != e; ++i)
24-
result.push_back(*i);
25-
return result;
26-
}
27-
}
28-
2915
template<class charT>
3016
basic_command_line_parser<charT>::
3117
basic_command_line_parser(const std::vector<
@@ -38,9 +24,7 @@ namespace boost { namespace program_options {
3824
basic_command_line_parser<charT>::
3925
basic_command_line_parser(int argc, const charT* const argv[])
4026
: detail::cmdline(
41-
// Explicit template arguments are required by gcc 3.3.1
42-
// (at least mingw version), and do no harm on other compilers.
43-
to_internal(detail::make_vector<charT, const charT* const*>(argv+1, argv+argc+!argc))),
27+
to_internal(std::vector<std::basic_string<charT> >(argv+1, argv+argc))),
4428
m_desc()
4529
{}
4630

@@ -49,7 +33,7 @@ namespace boost { namespace program_options {
4933
basic_command_line_parser<charT>&
5034
basic_command_line_parser<charT>::options(const options_description& desc)
5135
{
52-
detail::cmdline::set_options_description(desc);
36+
detail::cmdline::set_options_description(desc);
5337
m_desc = &desc;
5438
return *this;
5539
}

0 commit comments

Comments
 (0)