Omgili - forum search, search forums  
  

Discussions about string std

Displaying 1 - 10 out of 12,639 discussions.  
RSS Feed Options
Time Frame: (Any time)   Minimum number of replies: (2)   Minimum number of discussing users: (0)
  |  

Page: 1   2   3   4   5   6   7   8   9   10  
Keep this page open to be updated with the newest discussions automatically.
What's the difference between std::string and std::basic_string ? And why are both needed?
Started by on , 4 posts by 4 people.  
std::string is an instantiation of std::basic_string: typedef std....
std::basic_string is a class template for making strings out of character types, std::string required by the standard).
Why would I ever want to call std::string::data() over std::string::c_str() ? Surely there is some method to the standard's madness here...
Started by on , 3 posts by 3 people.  
Use c_str() if the code you are using assumes a string is NUL.
Data() returns a pointer to the data without any modifications .
With a NUL byte appended so you can use the return value as a "C string".
How can operator bool() cause an error when declaring operator std::string in a class and also serving as an implicit conversion to string by itself? #include <iostream> #include <string> using namespace std; class Test { public: operator ...
Started by on , 4 posts by 4 people.  
The problem you are facing (besides operator std::string() returning a bool) is that implicit conversions trigger when you want= matches: // using ....
Your operator std::string() needs to return a string, not a bool.
Ask your Facebook Friends
I keep receiving a C2664 conversion error in visual studio It tells me that it can't convert parameter 1 from const std::string to std::string&. I tried adding/removing the const in the stringToWstring prototype and in the function itself and the error...
Started by on , 3 posts by 3 people.  
Since you want to use std::_String_const_iterator<_Elem,_Traits,_Alloc> in the error message from the second const stdI think the tokenizer iterator....
Three template arguments, and the third one defaults to std::string .
Recently I've noticed that the following statement is not true given std::string s . s.max_size() == s.get_allocator().max_size(); I find this interesting, by default std::string will use std::allocator<char> which has a theoretical limit of size...
Started by on , 4 posts by 4 people.  
And after all std::basic_string is a container standard to store the string in ....
I am not entirely sure but as far as I know std::basic_string is not limited in the current it seems to be the case with STL containers.
I have a bunch of strings that I need to sort. I think a std::vector would be the easiest way to do this. However, I've never used vectors before and so would like some help. I just need to sort them alphanumerically, nothing special. Indeed, the string...
Started by on , 6 posts by 6 people.  
So * is needed c_str() is afaik a function of std::string and not a variable The problems in your In particular, std::string::compare couldn't be used as a comparator, because it doesn't do what sort::string makes ....
I'm being stupid here but I can't get the function signature for the predicate going to find_if when iterating over a string: bool func( char ); std::string str; std::find_if( str.begin(), str.end(), func ) ) In this instance google has not been my friend...
Started by on , 3 posts by 3 people.  
And, actually, you ....
) { return c == 'x'; } int main() { std::string str ="abcxyz";; std::string::iterator it = std::find::string str you can probably use std::find() rather than std::find_if() .
This may seem to be an academic question, but still I would be very interested in the answer: I have a vector of strings s in which I would like to find a given string findme . This can be done using something like find(s.begin(), s.end(), findme); My...
Started by on , 5 posts by 5 people.  
Another thing you are forgetting is that std::string::compare returns 0 for equal(), std::not1(....
std::equal_to<string>(), string("findme"))); One option is to cast the member function pointer to suitable type.
Can someone please post a simple code that would convert System::String^ to C++ std::string ? i.e I just want to assign the value of String^ originalString; to std::string newString;
Started by on , 4 posts by 4 people.  
Void StringToStlWString ( System::String const^ s, std::wstring& os) { String^ string = const_cast<::String^ StlWStringToString (std::wstring const& os) { String^ str = gcnew String(os.c_str(....
I know that the individual map queries take a maximum of log(N) time. However I was wondering, I have seen a lot of examples that use strings as map keys. What is the performance cost of associating a std::string as a key to a map instead of an int for...
Started by on , 7 posts by 7 people.  
To be something like this (untested): class Key { public: unsigned hash; std::string s; int cmp(const Key mentioned, a string key will also cause an additional memory allocation each time an item is added as the length of string....
Page: 1   2   3   4   5   6   7   8   9   10  
Related Searches
std string    cannot convert parameter 2 from std string[] to std string    cannot convert parameter 1 from 'std string' to 'System String ^'   
More Information


Forum Search About Omgili Help Plugins Forum/Board Owners Privacy

i
In Title
In Topic
In Reply
Exclude
Boost