Commit cd9c5709 authored by Davis King's avatar Davis King

Added an implicit conversion to unsigned long for extracting the checksum

of crc32 objects.
parent ff451abb
...@@ -55,6 +55,9 @@ namespace dlib ...@@ -55,6 +55,9 @@ namespace dlib
const std::vector<char>& item const std::vector<char>& item
); );
inline operator unsigned long (
) const { return get_checksum(); }
inline unsigned long get_checksum ( inline unsigned long get_checksum (
) const; ) const;
......
...@@ -101,6 +101,13 @@ namespace dlib ...@@ -101,6 +101,13 @@ namespace dlib
- returns the current checksum - returns the current checksum
!*/ !*/
operator unsigned long (
) const;
/*!
ensures
- returns get_checksum()
!*/
void swap ( void swap (
crc32& item crc32& item
); );
......
...@@ -65,7 +65,7 @@ namespace ...@@ -65,7 +65,7 @@ namespace
std::vector<char> buf; std::vector<char> buf;
for (int i = 0; i < 4000; ++i) for (int i = 0; i < 4000; ++i)
buf.push_back(i); buf.push_back(i);
DLIB_TEST(crc32(buf).get_checksum() == 492662731); DLIB_TEST(crc32(buf) == 492662731);
} }
} a; } a;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment