Swatch Time
10
template function to create a boost::shared_ptr in the form
boost::shared_ptr classPtr = new_ptr(Arg1, Arg2);
You can also make new_ptr_access a friend of className and make the constructor and destructor private.
This keeps the end user from:
Creating an instance manually on the heap
Creating an instance manually on the stack
Deleting a shared_ptr manually using "delete get()"
boost::shared_ptr classPtr = new_ptr(Arg1, Arg2);
You can also make new_ptr_access a friend of className and make the constructor and destructor private.
This keeps the end user from:
Creating an instance manually on the heap
Creating an instance manually on the stack
Deleting a shared_ptr manually using "delete get()"
10
Transform any basic type to string. Very handy for log messages
Usage:
int i(12);
float j(3.14);
cout
Usage:
int i(12);
float j(3.14);
cout
9
I was coding a project that used arrays when the lack of a standard foreach in C/C++ got to me. So, I coded this little function to help me. It applies a function that returns int to each element of the array.
8
Converts a string representation of a number with any base(binary, octal, decimal, hexadecimal, up to base 36) to a long int.
8
This little function puts a string of a specified color and (centered) location. However, keep the word simple in mind. I purposfully not made it capable of supporting newlines.
By the way, this is my first snippet
By the way, this is my first snippet
8
I made this a little while back for a friend who was having trouble learning sockets. Below are snf.h, snferror.h and example.cpp (a little example).
The example opens a "web server" at port 8080 on the machine. However, it displays just one page.
Have fun!
The example opens a "web server" at port 8080 on the machine. However, it displays just one page.
Have fun!
8
Convert an ebcdic buffer to an ascii buffer.
8
Add this header after all your other headers. Compiles on standards compliant compilers.
7
Simple tests for dir and file existance. Path creation and removal.
6
boost::format gives you the ablility to safely use printf like formatting as well as positional format specifiers ala .NET.









