Omgili - forum search, search forums  
  

Discussions about int main std

Displaying 1 - 10 out of 6,382 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.
Hi, how do I bind a std::ostream to either std::cout or to an std::ofstream object, depending on a certain program condition? Although this invalid for many reasons, I would like to achieve something that is semantically equivalent to the following: std...
Started by on , 4 posts by 4 people.  
This is exception-safe: void process(std::ostream &os); int main(int argc, char *argv[]) { std() { os.rdbuf(old_buf); } std::ostream& os; std::streambuf * old_buf; }; int main() { // or: ....
(I'm using Visual C++ 2008) I've always heard that main() is required to return an integer, but here I didn't put in return 0; and and it compiled with 0 errors and 0 warnings! In the debug window it says the program has exited with code 0. If this function...
Started by on , 5 posts by 5 people.  
The same return statement....
And it continuesI'm pretty sure VC++ just inserts a return 0 if you don't include one in main functions.
*/ } ....
*/ } and int main(int argc, char* argv[]) { /* ...
int main() { /* ...
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.  
When the compiler sees....
The problem you are facing (besides operator std::string() returning a bool) is that implicit conversions trigger when you want and when you don't.
Your operator std::string() needs to return a string, not a bool.
Ask your Facebook Friends
This isn't a design question, really, though it may seem like it. (Well, okay, it's kind of a design question). What I'm wondering is why the C++ std::fstream classes don't take a std::string in their constructor or open methods. Everyone loves code examples...
Started by on , 10 posts by 9 people.  
A better question would....
The same goes for std.
Many containers have a swap member function, but no overload of std::swap is supplied.
One other example is std::swap .
std::string and its use in the library is one of these.
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.  
#include <iostream> #include <string> #include <algorithm> int main....
) { return c == 'x'; } int main() { std::string str ="abcxyz";; std::string::iterator it = std::find;algorithm> .
In the following example i expected the swap of the bits. Instead the second bit becomes overwritten, but why and how could i achieve the expected behavior? #include <iostream> #include <string> #include <algorithm> using namespace std...
Started by on , 4 posts by 4 people.  
Right ) { bool temp = (bool)left; left = (bool)right; right = (bool)temp; } } Then: int main to 'swap(std::bitset<2u>::reference, std::bitset<2u>::reference)' /usr/include/c++/4.3/bits/stl_move.h:80: note: candidates....
It seems to me that using unanchored namespaces is just asking for trouble later when someone puts in a new namespace that happens to have the same name as a root level namespace and mysteriously alters the meaning of a whole lot of programs. So, why ...
Started by on , 9 posts by 9 people.  
int main() { string s = "sometext"; // no leading ::std } you should just never name a namespace stdIn the case of std I wouldn't assume any other namespace with the same name, same classes much artificial: namespace fred ....
This code throws up the compile error given in the title, can anyone tell me what to change? #include <iostream> using namespace std; int main(){ int myArray[10][10][10]; for (int i = 0; i <= 9; ++i){ for (int t = 0; t <=9; ++t){ for (int ...
Started by on , 5 posts by 5 people.  
Dimensional array with 4 de-references You only need 3 loops instead of 4, or int myArray[10][10][10][10]; int myArray[10][10][10]; should be int myArray[10][10][10][10]; What to change? Aside from the 3 or 4 dimensional array ....
I was writing an algorithm this morning and I ran into a curious situation. I have two std::map s. I want to perform a set intersection on the sets of the keys of each (to find which keys are common to both maps). At some point in the future, I think ...
Started by on , 7 posts by 7 people.  
std::copy....
What you basically want is a copy, as std::map doesn't keep the keys in a std::set.
PAIR::first_type& operator()(const T_PAIR& item) const { return item.first; } }; int main(int argc variants are not.
I've got a map that stores a simple struct with a key. The struct has two member functions, one is const the other not. I've managed calling the const function using std::for_each without any problems, but I've got some problems calling the non-const ...
Started by on , 5 posts by 5 people.  
MyStruct { void someConstFunction() const; void someFunction(); }; typedef std::map<int, MyStruct> MyMap; MyMap theMap; int main() { //call the const member function boost::for_each(theMap | boost, not a method of ....
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