|
|
Автор: Jacques Kerner <jacques.ker...@oktal.fr>
Дата: Mon, 22 Dec 2003 16:32:23 +0100
Местное время: Пн. 22 дек 2003 17:32
Тема: [Boost-users] program_options custom type problem
Hi,
I am trying to use a custom type with the program_options library, but I I define a class ApplicationLocator consisting of two integer members, bool operator>>(InputStreamable &output)
which results in an exception being thrown eventually, by this code template<typename Target, typename Source>
if(!(interpreter << arg && interpreter >> result))
The problem is that my >> operator returns true alright. Maybe I am #include <strstream>
class ApplicationLocator
};
bool operator>>(const std::stringstream & input, ApplicationLocator &output)
{ std::vector<std::string> splitString; boost::algorithm::split( splitString, std::string(input.str()), boost::lambda::_1=='.' ); if (splitString.size() > 1) { output.site = atoi(splitString[0].c_str()); output.application = atoi(splitString[1].c_str()); return true; } else { return true; } return true; }
std::stringstream & operator<<(std::stringstream & output, const ApplicationLocator & input) { output << input.site << "." << input.application << '\0'; return output; }
and the program_options related code :
boost::program_options::positional_options_description try
boost::program_options::store(boost::program_options::command_line_parser(a rgc, if (configurationVariablesMap.count("help"))
Thank you all in advance.
Jacques Kerner
Чтобы отправлять сообщения, сначала необходимо Войти.
Чтобы отправлять сообщения, сначала необходимо присоединиться к группе.
Перед отправкой сообщения обновите свой псевдоним на странице Настройки подписки.
У вас нет разрешения на отправку сообщений.
| ||||||||||||||