From: Philip Pronin Date: Sun, 14 Apr 2013 02:06:37 +0000 (-0700) Subject: do not include iostream from Range.h X-Git-Tag: v0.22.0~1007 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=570ec3333e183881ffe326fe64c97605a92008d1;p=folly.git do not include iostream from Range.h Summary: folly/Range.h is extensively used in fbcode, try to avoid including (which is pretty heavy), include forward declarations () instead. Also transitioned it from 'std type_traits' + 'boost type_traits' to 'std type_traits'. Test Plan: compiled, ran tests Reviewed By: soren@fb.com FB internal diff: D774834 --- diff --git a/folly/Range.cpp b/folly/Range.cpp index 2796cd47..c1e58eda 100644 --- a/folly/Range.cpp +++ b/folly/Range.cpp @@ -20,6 +20,7 @@ #include "folly/Range.h" #include // __v16qi +#include #include "folly/Likely.h" namespace folly { diff --git a/folly/Range.h b/folly/Range.h index 57db55c8..355b0855 100644 --- a/folly/Range.h +++ b/folly/Range.h @@ -25,13 +25,11 @@ #include #include #include -#include +#include #include #include #include #include -#include -#include #include #include "folly/CpuId.h" #include "folly/Traits.h" @@ -77,9 +75,9 @@ namespace detail { * For random-access iterators, the value before is simply i[-1]. */ template -typename boost::enable_if_c< - boost::is_same::iterator_category, - std::random_access_iterator_tag>::value, +typename std::enable_if< + std::is_same::iterator_category, + std::random_access_iterator_tag>::value, typename std::iterator_traits::reference>::type value_before(Iter i) { return i[-1]; @@ -89,9 +87,9 @@ value_before(Iter i) { * For all other iterators, we need to use the decrement operator. */ template -typename boost::enable_if_c< - !boost::is_same::iterator_category, - std::random_access_iterator_tag>::value, +typename std::enable_if< + !std::is_same::iterator_category, + std::random_access_iterator_tag>::value, typename std::iterator_traits::reference>::type value_before(Iter i) { return *--i; @@ -116,7 +114,7 @@ public: typedef std::size_t size_type; typedef Iter iterator; typedef Iter const_iterator; - typedef typename boost::remove_reference< + typedef typename std::remove_reference< typename std::iterator_traits::reference>::type value_type; typedef typename std::iterator_traits::reference reference; @@ -452,11 +450,11 @@ template struct ComparableAsStringPiece { enum { value = - (boost::is_convertible::value - && boost::is_same::value) + (std::is_convertible::value + && std::is_same::value) || - (boost::is_convertible::value - && boost::is_same::value) + (std::is_convertible::value + && std::is_same::value) }; }; @@ -467,7 +465,7 @@ struct ComparableAsStringPiece { */ template typename -boost::enable_if_c::value, bool>::type +std::enable_if::value, bool>::type operator==(const T& lhs, const U& rhs) { return StringPiece(lhs) == StringPiece(rhs); } @@ -477,7 +475,7 @@ operator==(const T& lhs, const U& rhs) { */ template typename -boost::enable_if_c::value, bool>::type +std::enable_if::value, bool>::type operator<(const T& lhs, const U& rhs) { return StringPiece(lhs) < StringPiece(rhs); } @@ -487,7 +485,7 @@ operator<(const T& lhs, const U& rhs) { */ template typename -boost::enable_if_c::value, bool>::type +std::enable_if::value, bool>::type operator>(const T& lhs, const U& rhs) { return StringPiece(lhs) > StringPiece(rhs); } @@ -497,7 +495,7 @@ operator>(const T& lhs, const U& rhs) { */ template typename -boost::enable_if_c::value, bool>::type +std::enable_if::value, bool>::type operator<=(const T& lhs, const U& rhs) { return StringPiece(lhs) <= StringPiece(rhs); } @@ -507,7 +505,7 @@ operator<=(const T& lhs, const U& rhs) { */ template typename -boost::enable_if_c::value, bool>::type +std::enable_if::value, bool>::type operator>=(const T& lhs, const U& rhs) { return StringPiece(lhs) >= StringPiece(rhs); } diff --git a/folly/experimental/exception_tracer/ExceptionTracer.cpp b/folly/experimental/exception_tracer/ExceptionTracer.cpp index d79eab85..a2bd9ef0 100644 --- a/folly/experimental/exception_tracer/ExceptionTracer.cpp +++ b/folly/experimental/exception_tracer/ExceptionTracer.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include "folly/experimental/exception_tracer/ExceptionAbi.h" diff --git a/folly/experimental/exception_tracer/ExceptionTracer.h b/folly/experimental/exception_tracer/ExceptionTracer.h index 84800bf3..809d81af 100644 --- a/folly/experimental/exception_tracer/ExceptionTracer.h +++ b/folly/experimental/exception_tracer/ExceptionTracer.h @@ -20,7 +20,8 @@ #ifndef FOLLY_EXPERIMENTAL_EXCEPTION_TRACER_EXCEPTIONTRACER_H_ #define FOLLY_EXPERIMENTAL_EXCEPTION_TRACER_EXCEPTIONTRACER_H_ -#include +#include +#include #include #include diff --git a/folly/experimental/exception_tracer/ExceptionTracerTest.cpp b/folly/experimental/exception_tracer/ExceptionTracerTest.cpp index d18364bd..5bf2dff4 100644 --- a/folly/experimental/exception_tracer/ExceptionTracerTest.cpp +++ b/folly/experimental/exception_tracer/ExceptionTracerTest.cpp @@ -15,6 +15,7 @@ */ +#include #include #include "folly/experimental/exception_tracer/ExceptionTracer.h"