8 #ifndef IMPBASE_UTILITY_H
9 #define IMPBASE_UTILITY_H
11 #include <IMP/base/base_config.h>
12 #include <boost/utility.hpp>
18 IMPBASE_BEGIN_NAMESPACE
20 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
28 inline T square(T t) {
39 inline bool is_nan(
const T &a) {
47 template <
class Range,
class Functor>
48 inline void for_each(
const Range &r,
const Functor &f) {
49 std::for_each(r.begin(), r.end(), f);
53 inline int compare(
const T &a,
const T &b) {
58 template <
class Out,
class In>
59 inline Out get_as(
const In &in) {
60 return Out(in.begin(), in.end());
Declare an efficient stl-compatible map.
#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
std::string get_unique_name(std::string templ)
Return a unique name produced from the string.
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.