allow folly Cursor to read and write floats
authorOmry Yadan <omry@fb.com>
Thu, 20 Feb 2014 01:33:43 +0000 (17:33 -0800)
committerDave Watson <davejwatson@fb.com>
Fri, 21 Feb 2014 21:40:49 +0000 (13:40 -0800)
Summary: and doubles!

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

Reviewed By: tudorb@fb.com

FB internal diff: D1175021

folly/io/Cursor.h

index bb0e5fdd4fc63f966757c1f25194ea943dce25c0..764f52a1f4d4b0ed419aa52cb3f15e84ef20459f 100644 (file)
@@ -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() {
     T val;
     pull(&val, sizeof(T));
   read() {
     T val;
     pull(&val, sizeof(T));
@@ -409,7 +409,7 @@ template <class Derived>
 class Writable {
  public:
   template <class T>
 class Writable {
  public:
   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) {
     const uint8_t* u8 = reinterpret_cast<const uint8_t*>(&value);
     Derived* d = static_cast<Derived*>(this);
   write(T value) {
     const uint8_t* u8 = reinterpret_cast<const uint8_t*>(&value);
     Derived* d = static_cast<Derived*>(this);
@@ -685,7 +685,7 @@ class QueueAppender : public detail::Writable<QueueAppender> {
   void ensure(uint64_t n) { queue_->preallocate(n, growth_); }
 
   template <class T>
   void ensure(uint64_t n) { queue_->preallocate(n, growth_); }
 
   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) {
     // We can't fail.
     auto p = queue_->preallocate(sizeof(T), growth_);
   write(T value) {
     // We can't fail.
     auto p = queue_->preallocate(sizeof(T), growth_);