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)
22 inline T square(T t) IMP_NO_SIDEEFFECTS;
24 inline T cube(T t) IMP_NO_SIDEEFFECTS;
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) {
59 template <
class Out,
class In>
60 inline Out get_as(
const In &in) {
61 return Out(in.begin(), in.end());
Various general useful macros for IMP.
Declare an efficient stl-compatible map.
int compare(const VectorD< D > &a, const VectorD< D > &b)
lexicographic comparison of two vectors
std::string get_unique_name(std::string templ)
A class for storing lists of IMP items.
bool isnan(const T &a)
Return true if a number is NaN.