Skip to content

Instantly share code, notes, and snippets.

View gregvw's full-sized avatar

Greg von Winckel gregvw

  • Sandia National Laboratories
  • Albuquerque, NM
View GitHub Profile
@svdamani
svdamani / sorts.hpp
Last active January 5, 2024 14:12
Sorting Algorithms using Iterators in C++
#include <algorithm>
template <class Iterator>
inline void BubbleSort(Iterator begin, Iterator end) {
for (Iterator i = begin; i != end; ++i)
for (Iterator j = begin; j < i; ++j)
if (*i < *j)
std::iter_swap(i, j);
}
@dsanders11
dsanders11 / StringConstant.h
Last active February 15, 2023 21:53
An implementation of compile time string constants in C++14. The StringConstant class provides an intuitive interface for concatenating and comparing equality of the string constants. Heavily commented since example template code never seems to be.
#ifndef STRING_CONSTANT_H
#define STRING_CONSTANT_H
#include <cstddef>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <utility>