const char*const instanceMethod(const char*const&) const;
const MyObject* a;
a->changeYourself()
std::list<std::string> myList;
auto listItr = myList.begin();
const char*const instanceMethod(const char*const&) const;
bool is_name ( char *str, /*char * namelist*/ const char* namelist )
{
char name[MAX_INPUT_LENGTH], part[MAX_INPUT_LENGTH];
char *list, *string;
/* fix crash on NULL namelist */
if (namelist == NULL || namelist[0] == '\0')
return FALSE;
/* fixed to prevent is_name on "" returning TRUE */
if (str[0] == '\0')
return FALSE;
string = str;
/* we need ALL parts of string to match part of namelist */
for ( ; ; ) /* start parsing string */
{
str = one_argument(str,part);
if (part[0] == '\0' )
return TRUE;
// ERROR:
@@ list = namelist;
for ( ; ; ) /* start parsing namelist */
{
list = one_argument(list,name);
if (name[0] == '\0') /* this name was not found */
return FALSE;
if (!str_prefix(string,name))
return TRUE; /* full pattern match */
if (!str_prefix(part,name))
break;
}
}
}
ch->quests.push_back(q); /*vs*/ ch->addQuest(q); // therefor keeping (quests) private
ch->quests.push_back(q); /*vs*/ ch->addQuest(q); // therefor keeping (quests) private
for ( auto q = _quests.begin(); q != _quests.end(); q++ )
send((*q)->Name());
//Lambda version
std::for_each(_quests.begin(), _quests.end(), [this] (Quest *quest) { this->send(quest->Name()); });
I understand char pointers, and a few other things, but instance methods? My true question is how Java / C# has managed
to keep so much of the C++ syntax, yet it seems that this isn't as much (if at all) of an issue. I am not questioning the logic
of protecting the application from bugs, I'm just wondering if it is more of a compiler matter.
Also, I'll throw this in here too. having to write:
Is so much just to get an iterator object. Is this the only way to do this? I suppose typedef could take care of most of the labor.
I'm afraid I just don't quite get all of C++'s quirks. Maybe that's why I'm all about learning it though!