9 #ifndef IMPKERNEL_BASE_UTILITY_H
10 #define IMPKERNEL_BASE_UTILITY_H
12 #include <IMP/kernel_config.h>
13 #include <boost/utility.hpp>
19 IMPKERNEL_BEGIN_NAMESPACE
21 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
29 inline T square(T t) {
40 inline bool is_nan(
const T &a) {
48 template <
class Range,
class Functor>
49 inline void for_each(
const Range &r,
const Functor &f) {
50 std::for_each(r.begin(), r.end(), f);
54 inline int compare(
const T &a,
const T &b) {
59 template <
class Out,
class In>
60 inline Out get_as(
const In &in) {
61 return Out(in.begin(), in.end());
69 IMPKERNEL_END_NAMESPACE
Helper functions to check for NaN or infinity.
std::string get_unique_name(std::string templ)
Return a unique name produced from the string.
#define IMP_NO_SIDEEFFECTS
Use this to label a function with no side effects.
int compare(const VectorD< D > &a, const VectorD< D > &b)
lexicographic comparison of two vectors
A class for storing lists of IMP items.
bool isnan(const T &a)
Return true if a number is NaN.
Various general useful macros for IMP.