Commit 3a9422d1 authored by Omry Yadan's avatar Omry Yadan Committed by Dave Watson

allow folly Cursor to read and write floats

Summary: and doubles!

Test Plan: none really, will test later for now it compiles

Reviewed By: tudorb@fb.com

FB internal diff: D1175021
parent 81823a9c
...@@ -86,7 +86,7 @@ class CursorBase { ...@@ -86,7 +86,7 @@ class CursorBase {
} }
template <class T> template <class T>
typename std::enable_if<std::is_integral<T>::value, T>::type typename std::enable_if<std::is_arithmetic<T>::value, T>::type
read() { read() {
T val; T val;
pull(&val, sizeof(T)); pull(&val, sizeof(T));
...@@ -409,7 +409,7 @@ template <class Derived> ...@@ -409,7 +409,7 @@ template <class Derived>
class Writable { class Writable {
public: public:
template <class T> template <class T>
typename std::enable_if<std::is_integral<T>::value>::type typename std::enable_if<std::is_arithmetic<T>::value>::type
write(T value) { write(T value) {
const uint8_t* u8 = reinterpret_cast<const uint8_t*>(&value); const uint8_t* u8 = reinterpret_cast<const uint8_t*>(&value);
Derived* d = static_cast<Derived*>(this); Derived* d = static_cast<Derived*>(this);
...@@ -685,7 +685,7 @@ class QueueAppender : public detail::Writable<QueueAppender> { ...@@ -685,7 +685,7 @@ class QueueAppender : public detail::Writable<QueueAppender> {
void ensure(uint64_t n) { queue_->preallocate(n, growth_); } void ensure(uint64_t n) { queue_->preallocate(n, growth_); }
template <class T> template <class T>
typename std::enable_if<std::is_integral<T>::value>::type typename std::enable_if<std::is_arithmetic<T>::value>::type
write(T value) { write(T value) {
// We can't fail. // We can't fail.
auto p = queue_->preallocate(sizeof(T), growth_); auto p = queue_->preallocate(sizeof(T), growth_);
......
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