void ArgumentGroup::accept(const Argument & argument)
{
    bool same_option = this->_num_selected > 0 && (this->_num_selected == 1 && this->_last_selected_option == argument.option());
    if(this->_mutually_exclusive && (this->_num_selected > 0) && (! same_option))
    {
        throw ArgParserError(DEBUG_INFO, "invalid option " + argument.option().option_string() + ": option " + this->_last_selected_option.option_string() + " already set in mutually exclusive group " + this->_name);
    }
    if(! same_option)
    {
        this->_last_selected_option = argument.option();
        ++this->_num_selected;
    }
}
void ArgumentGroup::validate_argument(const Argument & new_argument) const
{
    const Option & new_option = new_argument.option();
    for(argument_vector_type::const_iterator i = this->_arguments.begin(); i != this->_arguments.end(); ++i)
    {
        const Argument & old_argument = *i;
        const Option & old_option = old_argument.option();
        if(new_option.conflicts(old_option))
        {
            std::ostringstream os;
            os << "conflicting options <" << new_option.option_string() << "> and <" << old_option.option_string() << '>';
            throw ArgParserError(DEBUG_INFO, os.str());
        }
        if(new_option.same_dest(old_option))
        {
            if(new_argument.type() != old_argument.type())
            {
                std::ostringstream os;
                os << "conflicting options <" << new_option.option_string() << "> with type " << Type::label(new_argument.type())
                        << " and <" << old_option.option_string() << "> with type " << Type::label(new_argument.type());
                throw ArgParserError(DEBUG_INFO, os.str());
            }
            if(new_argument.multiplicity() != old_argument.multiplicity())
            {
                std::ostringstream os;
                os << "conflicting options <" << new_option.option_string() << "> with multiplicity " << new_argument.multiplicity()
                        << " and <" << old_option.option_string() << "> with multiplicity " << old_argument.multiplicity();
                throw ArgParserError(DEBUG_INFO, os.str());
            }
            if(new_argument.default_value() != old_argument.default_value())
            {
                std::ostringstream os;
                os << "conflicting options <" << new_option.option_string() << "> with default_value " << new_argument.default_value()
                        << " and <" << old_option.option_string() << "> with default_value " << old_argument.default_value();
                throw ArgParserError(DEBUG_INFO, os.str());
            }
        }
    }
}