Move range to the util namespace

This commit is contained in:
Danny Robson 2011-08-15 20:11:42 +10:00
parent 6e73c22d91
commit 306f852fc7
5 changed files with 57 additions and 53 deletions

View File

@ -30,7 +30,7 @@ using namespace std;
const ipv4::ip ipv4::ip::LOOPBACK (127, 0, 0, 1);
const ipv4::ip ipv4::ip::ANY ( 0, 0, 0, 0);
const range<ipv4::port> ipv4::WELL_KNOWN_PORT ( 0, 1023),
const util::range<ipv4::port> ipv4::WELL_KNOWN_PORT ( 0, 1023),
ipv4::REGISTERED_PORT ( 1024, 49151),
ipv4::PRIVATE_PORT (49152, 65535);

2
ip.hpp
View File

@ -52,7 +52,7 @@ namespace ipv4 {
typedef uint16_t port;
typedef uint32_t mask;
extern const range<port> WELL_KNOWN_PORT,
extern const util::range<port> WELL_KNOWN_PORT,
REGISTERED_PORT,
PRIVATE_PORT;
}

View File

@ -25,9 +25,9 @@
#include <algorithm>
using namespace util;
using namespace maths;
matrix::matrix (size_t _rows, size_t _columns):
m_rows (_rows),
m_columns (_columns),

View File

@ -8,6 +8,7 @@
using namespace std;
using namespace util;
/*
@ -81,6 +82,7 @@ range<T>::rand (void) const {
}
namespace util {
template <>
bool
range<float>::operator ==(const range<float> &rhs) const
@ -93,6 +95,7 @@ bool
range<double>::operator ==(const range<double> &rhs) const
{ return almost_equal (min, rhs.min) &&
almost_equal (max, rhs.max); }
}
template <typename T>

View File

@ -23,7 +23,7 @@
#include "json.hpp"
namespace util {
/**
* Represents a continuous range of values. Contains convenience functions
* and debugging checks.
@ -72,5 +72,6 @@ operator <<(std::ostream &os, const range<T> &rhs) {
os << '[' << rhs.min << ", " << rhs.max << ']';
return os;
}
}
#endif