This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <algorithm> | |
| #include <vector> | |
| using namespace std; | |
| int main () { | |
| int myints[] = {10,20,30,30,20,10,10,20}; | |
| vector<int> v(myints,myints+8); | |
| vector<int>::iterator low,up; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| error2str.o: error2str.h error2str.cpp | |
| g++ -c error2str.cpp | |
| client.cpp: error2str.h | |
| client.o: client.cpp | |
| g++ -c client.cpp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <netinet/in.h> | |
| #include <stdlib.h> | |
| #include <sys/socket.h> | |
| #include "error2str.h" | |
| int main(int argc, char* argv[]) | |
| { | |
| const int fd = socket(AF_INET,SOCK_STREAM,0/*protocol*/); | |
| if (fd == -1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef ERROR2STR | |
| #define ERROR2STR | |
| #include <errno.h> | |
| // -------------------------------------------------------------- | |
| namespace std | |
| { | |
| template<typename _Alloc> | |
| class allocator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <sstream> | |
| #include <string> | |
| #include <errno.h> | |
| // -------------------------------------------------------------- | |
| std::string error2str(const int err) | |
| { | |
| char buf[1024] = ""; | |
| errno = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <sstream> | |
| #include <string> | |
| #include <errno.h> | |
| #include <arpa/inet.h> | |
| #include <netinet/in.h> | |
| #include <string.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| class StaticClassType { | |
| public: | |
| StaticClassType() | |
| { | |
| // Notify when the static member is created | |
| std::cout << "We're in." << std::endl; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <algorithm> | |
| #include <iostream> | |
| #include <vector> | |
| using namespace std; | |
| #include <google/heap-profiler.h> | |
| // Usage is HEAPPROFILE=./profiler.hprof ./test | |
| // Then, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| test : test.cpp | |
| g++ -o test test.cpp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -I /Soft/mag/dev/tools/google-perftools/include/ /Soft/mag/dev/tools/google-perftools/lib/libtcmalloc_and_profiler.a | |
| #test : test.cpp | |
| # g++ -o test test.cpp | |
| */ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <map> | |
| #include <string> | |
| using namespace std; | |
| int main() | |
| { | |
| map<string,string> tmp; | |