8 #ifndef IMPBASE_UTILITY_H
9 #define IMPBASE_UTILITY_H
11 #include <IMP/base/base_config.h>
12 #include <boost/utility.hpp>
19 IMPBASE_BEGIN_NAMESPACE
23 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
25 inline T square(T t) IMP_NO_SIDEEFFECTS;
27 inline T cube(T t) IMP_NO_SIDEEFFECTS;
45 inline bool is_nan(
const T& a) {
53 template <
class Range,
class Functor>
54 inline void for_each(
const Range &r,
const Functor &f) {
55 std::for_each(r.begin(), r.end(), f);
59 inline int compare(
const T &a,
const T &b) {
65 template <
class Out,
class In>
66 inline Out get_as(
const In &in) {
67 return Out(in.begin(), in.end());