Omgili - forum search, search forums  
  

Discussions about const std

Displaying 1 - 10 out of 10,454 discussions.  
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.
Which is better for string literals, standard string or character array? I mean to say for constant strings, say const char name[] = "so"; //or to use const string name = "so";
Started by on , 5 posts by 5 people.  
Because passing string literals into functions....
I tend to favour const std::string over const char * for string literals.
std::string rather than const char* , as in the latter case size is lost, and will possibly need.
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.  
Separator<wchar_t>, std::wstring::const_iterator, std::wstring> In general when debugging std::_String_const_iterator<_Elem,_Traits,_Alloc> in the error message from the second const std....
How can I convert an std::string to a char* or a const char*?
Started by on , 4 posts by 4 people.  
You can use &mystring[0] to get a char * pointer of the string or you'll get a buffer... .
String to a function that needs const char* you can use std::string str; const char * c = str.c_strUse the .c_str() method for const char *.
Ask your Facebook Friends
Is there an elegant way to create and initialize a const std::vector<const T> like const T a[] = { ... } to a fixed (and small) number of values? I need to call a function frequently which expects a vector<T> , but these values will never ...
Started by on , 8 posts by 8 people.  
}; const std::vector<const T> s_blah....
const int* myInt = std::find( &MyInts[0], &MyInts it in two steps: namespace { const T s_actual_array[] = { ...
Would use algorithms against a const vector...
Sqlite3_column_text returns a const unsigned char*, how do I convert this to a std::string? I've tried std::string(), but I get an error. Code: temp_doc.uuid = std::string(sqlite3_column_text(this->stmts.read_documents, 0)); Error: 1>.\storage_manager...
Started by on , 8 posts by 8 people.  
You could try: temp_doc.uuid = std::string(reinterpret_cast<const char*>( sqlite3_column_text(this->stmts.read_documents, 0) )); While std::string could have a constructor that takes const it to const char* ....
Let's say that I've got a : #include <utility> using namespace std; typedef pair<int, int> my_pair; how do I initialize a const my_pair ?
Started by on , 4 posts by 4 people.  
Use its constructor: const my_pair p( 1, 2 ); const my_pair p = my_pair(3, 2); const my_pair p = std::make_pair( 2, 3);.
Is there a reason why passing a reference to a STL map as const causes the [] operator to break? I get this compiler error (gcc 4.2) when I use const: error: no match for ‘operator[]’ in ‘map[name]’ Here's the function prototype: void func(const char ...
Started by on , 5 posts by 5 people.  
Operator[] will add the element_iterator instead of iterator : std::map<std::string, std::string>::const_iterator it; it = map.find....
} Probably because there is no const operator[] in std::map.
() ) { //...
Hi I have a function which takes const std::wstring& font_family, i.e. Font Font::CreateFont(const std::wstring& font_family){ ... } By question is how can I call that funcion by passing a string literal (e.g monospace)? I tried CreateFont("monospace"...
Started by on , 3 posts by 3 people.  
std::wstring s(L"Monospace"); CreateFont(s); the ctor for wstring doesn't accept narrow.
String.
I have a class which returns a typed pointer to a "const TCHAR". I need to convert it to a std::string but I have not found a way to make this happen. Can anyone provide some insight on how to convert it?
Started by on , 5 posts by 5 people.  
Either....
You can the encoding.
Containing the character like this: const TCHAR example = _T('Q'); std::string mystring(1, example macros for this, e.g.: std::wstring str = CT2W(_T("A TCHAR string")); CT2W = Const Text To Wide.
I'm having trouble with some valarray function pointer code: double (*fp)(double) = sin; valarray<double> (*fp)(const valarray<double> &) = sin; The first compiles, the second gives: error: no matches converting function 'sin' to type 'class...
Started by on , 4 posts by 4 people.  
Note, that you should qualify all uses of sin says about sin(valarray<T>... .
Valarray<double> (*fp)(const valarray<double> &) = std::sin; That should work.
You speak about std::sin in the title, but then assign ::sin .
Page: 1   2   3   4   5   6   7   8   9   10  
More Information


Forum Search About Omgili Help Plugins Forum/Board Owners Privacy

i
In Title
In Topic
In Reply
Exclude
Boost