help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compilation issues with std::string


From: Grizlyk
Subject: Re: Compilation issues with std::string
Date: Mon, 12 Feb 2007 20:42:26 +0300

wazz wrote:
>
> test.cpp: In function `int main()':
> test.cpp:18: error: ISO C++ says that these are ambiguous,

Ambiguous between inherited "foo::operator[]" and "foo::operator const 
char*() + const_char*::operator[]"
define
    const char foo::operator[] (const int i) const { return c_str()[i]; }

or use explicit cast
    const char *const tmp=s;
    std::cout<<tmp[2]<<std::endl;

-- 
Maksim A. Polyanin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]