Home - Blog - Contact

IdOp

Custom Operator Library for C++

IdOp allows you to build custom pseudo-operators using a few simple macros. The macros generate several templates which can be entirely statically evaluated. Here is a short example:

template<typename T> class AssertOp {
public:
void operator()(const T& left, const T& right) const
{ assert(left != right); }
};
IDOP_CREATE_LEFT_HANDED_RET(^, _, ^, AssertOp, void)

This defines a pseudo-operator, ^_^, which can be used like the following:

int foo(int* bar)
{
   bar ^_^ NULL;
   // ...
}

You can also construct more sober operators like:

if ("Hello, world!" contains "Hello") // ...  

See IdOpExamples.cpp or the IdOp Reference for more information.

Downloads

Requires Boost.Preprocessor

2009-10-05 20:33 - IdOp-1.0.1.zip
Fixed compilation on gcc.

2009-10-05 15:14 - IdOp-1.0.zip
Operations can modify either operand.

2009-10-03 16:57 - IdOp-0.9.zip
Initial release.

Bugs or Comments?

E-mail me at cogwheel@cogwheel.info

Copyright ©2008-2009 Matthew Orlando
This site is not affiliated with Blizzard Entertainment or John Wiley and Sons.