/** * @file types.h * @brief Typedefs for easier changing of types * @author Richard Roberts * @created Aug 21, 2010 */ #pragma once #include namespace gtsam { /** * Integer variable index type */ typedef size_t Index; /** Helper class that uses templates to select between two types based on * whether TEST_TYPE is const or not. */ template struct const_selector { }; /** Specialization for the non-const version */ template struct const_selector { typedef AS_NON_CONST type; }; /** Specialization for the const version */ template struct const_selector { typedef AS_CONST type; }; /** * Helper struct that encapsulates a value with a default, this is just used * as a member object so you don't have to specify defaults in the class * constructor. */ template struct ValueWithDefault { T value; ValueWithDefault() : value(defaultValue) { } ValueWithDefault(const T& _value) : value(_value) { } T& operator*() { return value; } }; }