,虚拟继承,等等。这对你来说似乎很明显,因为你对C++很了解,但因为我更了解Java,所以我对WTF简直是摸不着头脑!?!?一方面,写得很好的问题。另一方面,如果要查看std::map@Xam的详细信息,写这篇文章所花的时间不到一半。在我发布到Stacko

,虚拟继承,等等。这对你来说似乎很明显,因为你对C++很了解,但因为我更了解Java,所以我对WTF简直是摸不着头脑!?!?一方面,写得很好的问题。另一方面,如果要查看std::map@Xam的详细信息,写这篇文章所花的时间不到一半。在我发布到Stacko,c++,inheritance,c++11,C++,Inheritance,C++11,,虚拟继承,等等。这对你来说似乎很明显,因为你对C++很了解,但因为我更了解Java,所以我对WTF简直是摸不着头脑!?!?一方面,写得很好的问题。另一方面,如果要查看std::map@Xam的详细信息,写这篇文章所花的时间不到一半。在我发布到Stackoverflow之前,我试着寻找一些东西。问题是我找错了东西。我忘了C++中没有接口。我试着在谷歌上搜索关于C++和继承的东西,因为按照我的想法,这是一个奇怪的继承问题。我从来没有想过要查找类模板、虚拟继承等等。这对你来说似乎很明显,因为你对C+


,虚拟继承,等等。这对你来说似乎很明显,因为你对C++很了解,但因为我更了解Java,所以我对WTF简直是摸不着头脑!?!?一方面,写得很好的问题。另一方面,如果要查看
std::map
@Xam的详细信息,写这篇文章所花的时间不到一半。在我发布到Stackoverflow之前,我试着寻找一些东西。问题是我找错了东西。我忘了C++中没有接口。我试着在谷歌上搜索关于C++和继承的东西,因为按照我的想法,这是一个奇怪的继承问题。我从来没有想过要查找类模板、虚拟继承等等。这对你来说似乎很明显,因为你对C++很了解,但因为我对Java更了解,所以我对WTF简直是摸不着头脑!?!?
typedef std::string ArgName;
typedef std::map< ArgName, AnyData > ArgumentMap;

class Arguments : public ArgumentMap
{
    public:
    // Very important note: When read finds a numeric/set argument,
    // it sets anyData.kind to Int. But STILL, it fills anyData.dString,
    // just in case. So if the ArgumentMap was built by Arguments::read,
    // the dString fields are all filled.
    bool read( int argc, char **argv );

    // remains is filled with the arguments not starting with '-'.
    bool read( int argc, char **argv, std::vector<const char*>& remains );

    // const if fails, erases arg if succeeds.
    bool getNumericParam( const ArgName& name, int& num );

    // sw is true if the switch is present. The function
    // returns false if the argument value is not empty.
    bool getSwitch( const ArgName& name, bool& sw );

    bool getSwitchConst( const ArgName& name, bool& sw ) const;

    // Returns true if the switch is present. Throws an error message if
    // if the argument value is not empty.
    bool getSwitchCompact( const ArgName& name );

    void checkEmptyArgs() const;

};