Skip to content

Instantly share code, notes, and snippets.

View bradtgmurray's full-sized avatar

Brad Murray bradtgmurray

  • Beeper
  • Waterloo, Ontario
View GitHub Profile
char* it = "xxxxxxxxxxx";
if(it[0] == '.')
{
if(it[1] == '/')
{
doSomething();
it += 2;
}
else if (it[1] == 0)
char* it = "xxxxxxxxxxx";
if(it[0] == '.' && (it[1] == '/' || it[1] == 0))
{
doSomething();
it += (it[1] == 0 ? 1 : 2);
}
char* it = "xxxxxxxxxxx";
if(it[0] == '.')
{
switch(it[1])
{
case '/':
it++;
//fall through
case '\0':
#include <cstdlib> // atoi
#include <iostream>
using namespace std;
void do_work( int C1, int C2, int C3 ) {
for ( int i = 0 ; i < 8 ; i += 1 ) {
cout << "S1 i:" << i << endl;
for ( int j = 0 ; j < 4 ; j += 1 ) {
cout << "S2 i:" << i << " j:" << j << endl;
for ( int k = 0 ; k < 2 ; k += 1 ) {
void ClipEndAgainstPlane(Vector4D& a, Vector4D& b, int axis)
{
std::cout << " ClipEndAgainstPane " << a << b << std::endl;
// Positive side
if (a[axis] > a[3])
{
double alpha = (a[3] - a[axis])/(b[axis] - a[axis]);
std::cout << " Clipping against positive " << alpha << std::endl;
for(int i = 0; i < 4; ++i)
{
SensorBaseTest a = SensorBaseTest(5);
SensorBaseTest b = SensorBaseTest(7);
SensorAggregator _sensors = SensorAggregator((SensorBase*[]){&a, &b});
public final void b(WrapperFIXED_A l1, WrapperFIXED_B l2, int l3)
{
WrapperFIXED_C cWRAP = NULL;
if(l2 == null)
{
// Roger wanted me to make sure that this cant happen if it does anyways
String checkIT = new String(l1.VALUE())
if(checkIT == NULL)
{
throw RuntimeException("CRTIAL ERROR! THIS CANNOT HAPPEN!!!!!");
#include <algorithm>
#include <functional>
#include <vector>
class A
{
int value;
public:
void Add(int num)
template<class T>
struct Deleter
{
void operator()(const T* ptr) const
{
delete ptr;
}
};
std::vector<int*> numbers;
class WellBehavedFunctor : public unary_functor<int, bool>
{
public:
bool operator()(int i) { return i < 3; }
}
std::vector<int> numbers;
// Prints the number of numbers in the numbers vector that are 3 or greater.
std::cout << std::count_if(numbers.begin(), numbers.end(), std::not1(WellBehavedFunctor()));