Hi! I use MS VC8.0 (2005) Express Edition. This code sample causes the following assertion: int main(int argc, char* argv[]) { options_description generic("Generic options"); generic.add_options() ("version,v", "print version string") ("help,h", "produce help message") ; // Declare a group of options that will be // allowed both on command line and in // config file options_description config("Configuration"); config.add_options() ("worker-threads,w", po::value<int>()->default_value(20), "Each worker thread starts parsing of one file.\ndefault: 20") ; options_description cmdline_opt, cfgf_opt; cmdline_opt.add(generic).add(config); cfgf_opt.add(config); variables_map vm; store(command_line_parser(argc, argv).options(cmdline_opt).run(), vm); ifstream ifs("scanning_options.cfg"); store(parse_config_file(ifs, cfgf_opt), vm); notify(vm); if(vm.count("help")) cout << config << endl; //... some other code return 0; } In this line: cout << config << endl; I receive an assertion: Debug Assertion Failed! Program: e:\projects\...\protocol_scanner.exe File: e:\program files\microsoft visual studio 8\vc\include\xstring Line: 173 Expression: ("_Myptr + _Off <= (((_Mystring *)this->_Mycont)->_Myptr() + ((_Mystring *)this->_Mycont)->_Mysize) && _Myptr + _Off >= ((_Mystring*)this->_Mycont)->_Myptr()",0) ... line 173 is part of a function in xstring _Myt& __CLR_OR_THIS_CALL operator+=(difference_type _Off) { // increment by integer if (this->_Mycont != _IGNORE_MYCONT) { _SCL_SECURE_VALIDATE(this->_Mycont != NULL); _SCL_SECURE_VALIDATE_RANGE( _Myptr + _Off <= (((_Mystring *)this->_Mycont)->_Myptr() + ((_Mystring *)this->_Mycont)->_Mysize) && _Myptr + _Off >= ((_Mystring *)this->_Mycont)->_Myptr()); // <- line 173 } _Myptr += _Off; return (*this); } Output in stdout window looks like: Generic options: -v [ --version ] print version string -h [ --help ] produce help message Configuration: -w [ --worker-threads ] arg (=20) -------------------------^^^^^^^^^^ this looks really weired!!! Here should be another message. Last line is really weired... Stack trace is:
protocol_scanner.exe!std::_String_const_iterator
& os={...}, std::basic_string par="Each worker thread starts parsing of one file.", unsigned int first_column_width=36, unsigned int line_length=79) Line 381 + 0x28 bytes C++
protocol_scanner.exe!boost::program_options::`anonymous
namespace'::format_description(std::basic_ostream & os={...}) Line 522 + 0x1e bytes C++
protocol_scanner.exe!boost::program_options::operator<<(std::basic_ostream Parameter of executable is:
--help
With Kind Regards,
Ovanes Markarian