Re: [Boost-bugs] [Boost C++ Libraries] #3264: open config file

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3264: open config file
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-02 08:56:39


#3264: open config file
---------------------------------------------------------+------------------
 Reporter: Diederick C. Niehorster <dcnieho@…> | Owner: vladimir_prus
     Type: Feature Requests | Status: new
Milestone: Boost 1.40.0 | Component: program_options
  Version: Boost 1.39.0 | Severity: Optimization
 Keywords: |
---------------------------------------------------------+------------------
Changes (by s.ochsenknecht@…):

 * cc: s.ochsenknecht@… (added)

Comment:

 I see one problem here. How to determine if a ifstream or a wifstream
 should be used? Both take (const char*) as type for the file name.

 One Solution could be:
 We can implement a template with a basic_string<char> and
 basic_string<wchar_t> instantiation for the file name. So, if the file
 name comes with a basic_string<wchar_t> then we use wifstream, the file
 name has to be converted to (const char* ).
 {{{
 template<charT>
 parse_config_file(const std::basic_string<charT>&, ...);
 }}}


 Another solution could be:
 The function takes const char* parameter for file name which is directly
 passed to ifstream/wifstream:
 {{{
 template<charT>
 parse_config_file(const char*, ...);
 }}}
 But how the user can choose now between ifstream and wifstream?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3264#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC