I absolutely love the way Xcode offers insight into possible available member functions of the language and would prefer to use it relative to, say, text mate, if not for an oddity i noticed today.
When string s = "Test string"; the only available substr signature is as shown

From what i understand however, and what i see online the signature should be
string substr ( size_t pos = 0, size_t n = npos ) const;
Indeed s.substr(1,2); is both understood and works in Xcode.
Why does it not show when i try to method complete? (Ctrl-Space)
Xcode is performing the completion correctly, but it’s not what you expect. You’ve actually answered the question yourself unknowingly. The function signature for
string‘ssubstr()method, just as you said, is:All arguments to
substr()have default assignments, therefore to Xcode,s.substr()(with no arguments) is the valid code completion to insert because it’s reallys.substr(0, s.npos). You can confirm this with any number of standard C++ functions with default arguments. The easiest place to see this is with any STL container constructor.Take for instance a
vector. We all know thatvectorscan take anAllocator, but the default argument assignedAllocatoris “good enough” for most casual uses. Sure enough, two of the signatures forvectorconstructors are:In both cases, the
Allocatorargument has a default assignment, and in the second, theTdefault value has a default assignment. Now, take a look at what Xcode suggests when constructing avector:The suggestion with no argument list is actually the constructor that takes just an
Allocator. The suggestion that takes just asize_typeis actually the constructor that takes asize_type,T, andAllocator.Depending on how you think about this, it may or may not be an Xcode bug. Ideally, you want to see completions with default arguments for simpler functions like
substr(), but for STL container constructors, you probably almost never want to see them. Perhaps it could be an option, but I wouldn’t expect to see this corrected. I’d happily dup a radar with you though.