Skip to content

Instantly share code, notes, and snippets.

View bradtgmurray's full-sized avatar

Brad Murray bradtgmurray

  • Beeper
  • Waterloo, Ontario
View GitHub Profile
template <int WIDTH, int HEIGHT>
class Matrix
{
protected:
double m_data[WIDTH* HEIGHT];
public:
Matrix();
};
class A
{
public:
A(int i)
{
printf("A constructor: %u\n", i);
}
};
void const_func()
class Object
{
...
}
Object FuncThatReturnObject()
{
Object o;
...
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()));
template<class T>
struct Deleter
{
void operator()(const T* ptr) const
{
delete ptr;
}
};
std::vector<int*> numbers;
#include <algorithm>
#include <functional>
#include <vector>
class A
{
int value;
public:
void Add(int num)
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!!!!!");
SensorBaseTest a = SensorBaseTest(5);
SensorBaseTest b = SensorBaseTest(7);
SensorAggregator _sensors = SensorAggregator((SensorBase*[]){&a, &b});
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)
{
#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 ) {