uint32_t entryCountThreadCacheSize;
size_t capacity; // if positive, overrides maxLoadFactor
- public:
// Cannot have constexpr ctor because some compilers rightly complain.
Config() : emptyKey((KeyT)-1),
lockedKey((KeyT)-2),
template <class Char>
class fbstring_core_model {
-public:
+ public:
fbstring_core_model();
fbstring_core_model(const fbstring_core_model &);
~fbstring_core_model();
// the string without reallocation. For reference-counted strings,
// it should fork the data even if minCapacity < size().
void reserve(size_t minCapacity);
-private:
+ private:
// Do not implement
fbstring_core_model& operator=(const fbstring_core_model &);
};
* to extract capacity/category.
*/
template <class Char> class fbstring_core {
-protected:
+ protected:
// It's MSVC, so we just have to guess ... and allow an override
#ifdef _MSC_VER
# ifdef FOLLY_ENDIAN_BE
static constexpr auto kIsLittleEndian =
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__;
#endif
-public:
+ public:
fbstring_core() noexcept { reset(); }
fbstring_core(const fbstring_core & rhs) {
return category() == Category::isLarge && RefCounted::refs(ml_.data_) > 1;
}
-private:
+ private:
// Disabled
fbstring_core & operator=(const fbstring_core & rhs);
*/
template <class Char>
class dummy_fbstring_core {
-public:
+ public:
dummy_fbstring_core() {
}
dummy_fbstring_core(const dummy_fbstring_core& another)
backend_.reserve(minCapacity);
}
-private:
+ private:
std::basic_string<Char> backend_;
};
#endif // !_LIBSTDCXX_FBSTRING
static constexpr size_type npos = size_type(-1);
typedef std::true_type IsRelocatable;
-private:
+ private:
static void procrustes(size_type& n, size_type nmax) {
if (n > nmax) {
n = nmax;
static size_type traitsLength(const value_type* s);
-public:
+ public:
// C++11 21.4.2 construct/copy/destroy
// Note: while the following two constructors can be (and previously were)
}
#endif
-private:
- iterator
- insertImplDiscr(const_iterator i, size_type n, value_type c, std::true_type);
-
- template <class InputIter>
- iterator
- insertImplDiscr(const_iterator i, InputIter b, InputIter e, std::false_type);
-
- template <class FwdIterator>
- iterator insertImpl(
- const_iterator i,
- FwdIterator s1,
- FwdIterator s2,
- std::forward_iterator_tag);
-
- template <class InputIterator>
- iterator insertImpl(
- const_iterator i,
- InputIterator b,
- InputIterator e,
- std::input_iterator_tag);
-
-public:
+ private:
+ iterator
+ insertImplDiscr(const_iterator i, size_type n, value_type c, std::true_type);
+
+ template <class InputIter>
+ iterator
+ insertImplDiscr(const_iterator i, InputIter b, InputIter e, std::false_type);
+
+ template <class FwdIterator>
+ iterator insertImpl(
+ const_iterator i,
+ FwdIterator s1,
+ FwdIterator s2,
+ std::forward_iterator_tag);
+
+ template <class InputIterator>
+ iterator insertImpl(
+ const_iterator i,
+ InputIterator b,
+ InputIterator e,
+ std::input_iterator_tag);
+
+ public:
template <class ItOrLength, class ItOrChar>
iterator insert(const_iterator p, ItOrLength first_or_n, ItOrChar last_or_c) {
using Sel = std::integral_constant<
return replace(i1, i2, s, traitsLength(s));
}
-private:
- basic_fbstring& replaceImplDiscr(
- iterator i1,
- iterator i2,
- const value_type* s,
- size_type n,
- std::integral_constant<int, 2>);
-
- basic_fbstring& replaceImplDiscr(
- iterator i1,
- iterator i2,
- size_type n2,
- value_type c,
- std::integral_constant<int, 1>);
-
- template <class InputIter>
- basic_fbstring& replaceImplDiscr(
- iterator i1,
- iterator i2,
- InputIter b,
- InputIter e,
- std::integral_constant<int, 0>);
-
-private:
- template <class FwdIterator>
- bool replaceAliased(iterator /* i1 */,
- iterator /* i2 */,
- FwdIterator /* s1 */,
- FwdIterator /* s2 */,
- std::false_type) {
+ private:
+ basic_fbstring& replaceImplDiscr(
+ iterator i1,
+ iterator i2,
+ const value_type* s,
+ size_type n,
+ std::integral_constant<int, 2>);
+
+ basic_fbstring& replaceImplDiscr(
+ iterator i1,
+ iterator i2,
+ size_type n2,
+ value_type c,
+ std::integral_constant<int, 1>);
+
+ template <class InputIter>
+ basic_fbstring& replaceImplDiscr(
+ iterator i1,
+ iterator i2,
+ InputIter b,
+ InputIter e,
+ std::integral_constant<int, 0>);
+
+ private:
+ template <class FwdIterator>
+ bool replaceAliased(
+ iterator /* i1 */,
+ iterator /* i2 */,
+ FwdIterator /* s1 */,
+ FwdIterator /* s2 */,
+ std::false_type) {
return false;
}
return r != 0 ? r : n1 > n2 ? 1 : n1 < n2 ? -1 : 0;
}
-private:
+ private:
// Data
Storage store_;
};
//===========================================================================
//---------------------------------------------------------------------------
// implementation
-private:
-
+ private:
typedef std::allocator_traits<Allocator> A;
struct Impl : public Allocator {
//===========================================================================
//---------------------------------------------------------------------------
// types and constants
-public:
-
+ public:
typedef T value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-private:
-
+ private:
typedef std::integral_constant<bool,
IsTriviallyCopyable<T>::value &&
sizeof(T) <= 16 // don't force large structures to be passed by value
//===========================================================================
//---------------------------------------------------------------------------
// allocator helpers
-private:
-
+ private:
//---------------------------------------------------------------------------
// allocate
//===========================================================================
//---------------------------------------------------------------------------
// algorithmic helpers
-private:
-
+ private:
//---------------------------------------------------------------------------
// destroy_range
//===========================================================================
//---------------------------------------------------------------------------
// relocation helpers
-private:
-
+ private:
// Relocation is divided into three parts:
//
// 1: relocate_move
//===========================================================================
//---------------------------------------------------------------------------
// construct/copy/destroy
-public:
-
+ public:
fbvector() = default;
explicit fbvector(const Allocator& a) : impl_(a) {}
return impl_;
}
-private:
-
+ private:
// contract dispatch for iterator types fbvector(It first, It last)
template <class ForwardIterator>
fbvector(ForwardIterator first, ForwardIterator last,
//===========================================================================
//---------------------------------------------------------------------------
// iterators
-public:
-
+ public:
iterator begin() noexcept {
return impl_.b_;
}
//===========================================================================
//---------------------------------------------------------------------------
// capacity
-public:
-
+ public:
size_type size() const noexcept {
return size_type(impl_.e_ - impl_.b_);
}
}
}
-private:
-
+ private:
bool reserve_in_place(size_type n) {
if (!usingStdAllocator::value || !usingJEMalloc()) return false;
//===========================================================================
//---------------------------------------------------------------------------
// element access
-public:
-
+ public:
reference operator[](size_type n) {
assert(n < size());
return impl_.b_[n];
//===========================================================================
//---------------------------------------------------------------------------
// data access
-public:
-
+ public:
T* data() noexcept {
return impl_.b_;
}
//===========================================================================
//---------------------------------------------------------------------------
// modifiers (common)
-public:
-
+ public:
template <class... Args>
void emplace_back(Args&&... args) {
if (impl_.e_ != impl_.z_) {
M_destroy_range_e(impl_.b_);
}
-private:
-
+ private:
// std::vector implements a similar function with a different growth
// strategy: empty() ? 1 : capacity() * 2.
//
//===========================================================================
//---------------------------------------------------------------------------
// modifiers (erase)
-public:
-
+ public:
iterator erase(const_iterator position) {
return erase(position, position + 1);
}
//===========================================================================
//---------------------------------------------------------------------------
// modifiers (insert)
-private: // we have the private section first because it defines some macros
-
+ private: // we have the private section first because it defines some macros
bool isValid(const_iterator it) {
return cbegin() <= it && it <= cend();
}
//---------------------------------------------------------------------------
// insert dispatch for iterator types
-private:
-
+ private:
template <class FIt>
iterator insert(const_iterator cpos, FIt first, FIt last,
std::forward_iterator_tag) {
//===========================================================================
//---------------------------------------------------------------------------
// lexicographical functions
-public:
-
+ public:
bool operator==(const fbvector& other) const {
return size() == other.size() && std::equal(begin(), end(), other.begin());
}
//===========================================================================
//---------------------------------------------------------------------------
// friends
-private:
-
+ private:
template <class _T, class _A>
friend _T* relinquish(fbvector<_T, _A>&);
struct BiggerThanChar { char unused[2]; };
template <typename C, typename D> static char test(decltype(C() < D())*);
template <typename, typename> static BiggerThanChar test(...);
-public:
+
+ public:
enum { value = sizeof(test<T, U>(0)) == 1 };
};
// items in the pair.
template <typename T1, typename T2>
struct hash<std::pair<T1, T2> > {
- public:
+ public:
size_t operator()(const std::pair<T1, T2>& x) const {
return folly::hash::hash_combine(x.first, x.second);
}
return *value_;
}
-private:
+ private:
Optional<result_type> value_;
Func func_;
};
{
typedef typename std::remove_reference<Allocator>::type allocator_type;
-public:
+ public:
typedef typename Allocator::pointer pointer;
allocator_delete() = default;
typedef typename std::remove_reference<T>::type value_type;
typedef value_type* pointer;
-public:
+ public:
constexpr static bool value = !has_destroy<allocator, void(pointer)>::value
&& !has_destroy<allocator, void(void*)>::value;
};
*/
template <typename T>
class enable_shared_from_this : public std::enable_shared_from_this<T> {
-public:
+ public:
constexpr enable_shared_from_this() noexcept = default;
std::weak_ptr<T> weak_from_this() noexcept {
return weak_from_this_<T>(this);
}
-private:
+ private:
// Uses SFINAE to detect and call
// std::enable_shared_from_this<T>::weak_from_this() if available. Falls
// back to std::enable_shared_from_this<T>::shared_from_this() otherwise.
// still properly result in a compile error.
typedef typename std::add_lvalue_reference<T>::type reference;
-public:
+ public:
/*
* If you default construct one of these, you must call this init()
* function before using it.
return ret;
}
-private:
- char pad0_[CacheLocality::kFalseSharingRange];
- const uint32_t size_;
- T* const records_;
+ private:
+ char pad0_[CacheLocality::kFalseSharingRange];
+ const uint32_t size_;
+ T* const records_;
- FOLLY_ALIGN_TO_AVOID_FALSE_SHARING std::atomic<unsigned int> readIndex_;
- FOLLY_ALIGN_TO_AVOID_FALSE_SHARING std::atomic<unsigned int> writeIndex_;
+ FOLLY_ALIGN_TO_AVOID_FALSE_SHARING std::atomic<unsigned int> readIndex_;
+ FOLLY_ALIGN_TO_AVOID_FALSE_SHARING std::atomic<unsigned int> writeIndex_;
- char pad1_[CacheLocality::kFalseSharingRange - sizeof(writeIndex_)];
+ char pad1_[CacheLocality::kFalseSharingRange - sizeof(writeIndex_)];
};
}
*/
template <class Iter>
class Range : private boost::totally_ordered<Range<Iter> > {
-public:
+ public:
typedef std::size_t size_type;
typedef Iter iterator;
typedef Iter const_iterator;
constexpr Range(const Range&) = default;
constexpr Range(Range&&) = default;
-public:
+ public:
// Works for all iterators
constexpr Range(Iter start, Iter end) : b_(start), e_(end) {
}
-> decltype(process(std::declval<Range>(), std::forward<Args>(args)...))
{ return process(split_step(delimiter), std::forward<Args>(args)...); }
-private:
+ private:
Iter b_, e_;
};
uint32_t spinCount;
- public:
+ public:
Sleeper() : spinCount(0) {}
void wait() {
return std::move(*this);
}
-private:
+ private:
dynamic val_;
};
* Object value iterators dereference as the values in the object.
* Object item iterators dereference as pairs of (key, value).
*/
-private:
+ private:
typedef std::vector<dynamic> Array;
-public:
+
+ public:
typedef Array::iterator iterator;
typedef Array::const_iterator const_iterator;
typedef dynamic value_type;
* d["key"] = 12;
* d["something_else"] = dynamic::array(1, 2, 3, nullptr);
*/
-private:
+ private:
struct EmptyArrayTag {};
struct ObjectMaker;
-public:
+ public:
static void array(EmptyArrayTag);
template <class... Args>
static dynamic array(Args&& ...args);
iterator begin();
iterator end();
-private:
+ private:
/*
* Helper object returned by keys(), values(), and items().
*/
template <class T> struct IterableProxy;
-public:
+ public:
/*
* You can iterate over the keys, values, or items (std::pair of key and
* value) in an object. Calling these on non-objects will throw a TypeError.
*/
std::size_t hash() const;
-private:
+ private:
friend struct TypeError;
struct ObjectImpl;
template <class T> struct TypeInfo;
void print(std::ostream&) const;
void print_as_pseudo_json(std::ostream&) const; // see json.cpp
-private:
+ private:
Type type_;
union Data {
explicit Data() : nul(nullptr) {}
// DynamicParser.h.
namespace detail {
class IdentifyCallable {
-public:
+ public:
enum class Kind { Function, MemberFunction };
template <typename Fn>
constexpr static Kind getKind() { return test<Fn>(nullptr); }
-private:
+
+ private:
template <typename Fn>
using IsMemFn = typename boost::function_types::template is_member_pointer<
decltype(&Fn::operator())
* {"nested": {"key1": {"key_errors": {"key3": "err"}, "value": 7}}}
*/
const folly::dynamic& error() const { return error_; }
-private:
+
+ private:
folly::dynamic error_;
};
};
class DynamicParser {
-public:
+ public:
enum class OnError {
// After parsing, releaseErrors() reports all parse errors.
// Throws DynamicParserLogicError on programmer errors.
return *this;
}
-private:
+ private:
/**
* If `fn` throws an exception, wrapError() catches it and inserts an
* enriched description into stack_.errors_. If lookup_key is non-null,
explicit Pop(ParserStack* sp)
: key_(sp->key_), value_(sp->value_), stackPtr_(sp) {}
void operator()() noexcept; // ScopeGuard requires noexcept
- private:
+ private:
const folly::dynamic* key_;
const folly::dynamic* value_;
ParserStack* stackPtr_;
template <typename T, template <typename> class Atom = std::atomic>
class LockFreeRingBuffer: boost::noncopyable {
+ static_assert(
+ std::is_nothrow_default_constructible<T>::value,
+ "Element type must be nothrow default constructible");
- static_assert(std::is_nothrow_default_constructible<T>::value,
- "Element type must be nothrow default constructible");
+ static_assert(
+ FOLLY_IS_TRIVIALLY_COPYABLE(T),
+ "Element type must be trivially copyable");
- static_assert(FOLLY_IS_TRIVIALLY_COPYABLE(T),
- "Element type must be trivially copyable");
-
-public:
+ public:
/// Opaque pointer to a past or future write.
/// Can be moved relative to its current location but not in absolute terms.
struct Cursor {
return prevTicket != ticket;
}
- protected: // for test visibility reasons
+ protected: // for test visibility reasons
uint64_t ticket;
friend class LockFreeRingBuffer;
};
~LockFreeRingBuffer() {
}
-private:
+ private:
const uint32_t capacity_;
const std::unique_ptr<detail::RingBufferSlot<T,Atom>[]> slots_;
namespace detail {
template <typename T, template <typename> class Atom>
class RingBufferSlot {
-public:
+ public:
explicit RingBufferSlot() noexcept
: sequencer_()
, data()
return sequencer_.isTurn((turn + 1) * 2);
}
-
-private:
+ private:
TurnSequencer<Atom> sequencer_;
T data;
}; // RingBufferSlot
class Alloc = std::allocator<std::pair<const StringPiece, Value>>>
class StringKeyedMap
: private std::map<StringPiece, Value, Compare, Alloc> {
-private:
+ private:
using Base = std::map<StringPiece, Value, Compare, Alloc>;
-public:
+ public:
typedef typename Base::key_type key_type;
typedef typename Base::mapped_type mapped_type;
typedef typename Base::value_type value_type;
class Alloc = std::allocator<StringPiece>>
class StringKeyedSetBase
: private std::set<StringPiece, Compare, Alloc> {
-private:
+ private:
using Base = std::set<StringPiece, Compare, Alloc>;
-public:
+ public:
typedef typename Base::key_type key_type;
typedef typename Base::value_type value_type;
typedef typename Base::key_compare key_compare;
private:
using Base = std::unordered_map<StringPiece, Value, Hash, Eq, Alloc>;
-public:
+ public:
typedef typename Base::key_type key_type;
typedef typename Base::mapped_type mapped_type;
typedef typename Base::value_type value_type;
: private std::unordered_set<StringPiece, Hasher, Eq, Alloc> {
using Base = std::unordered_set<StringPiece, Hasher, Eq, Alloc>;
-public:
+ public:
typedef typename Base::key_type key_type;
typedef typename Base::value_type value_type;
typedef typename Base::hasher hasher;
* upon destruction, also changing back to the original working directory.
*/
class ChangeToTempDir {
-public:
+ public:
ChangeToTempDir();
~ChangeToTempDir();
const fs::path& path() const { return dir_.path(); }
-private:
+ private:
fs::path initialPath_;
TemporaryDirectory dir_;
};
* Great for testing logging (see also glog*Pattern()).
*/
class CaptureFD {
-private:
+ private:
struct NoOpChunkCob { void operator()(StringPiece) {} };
-public:
+
+ public:
using ChunkCob = std::function<void(folly::StringPiece)>;
/**
*/
std::string readIncremental();
-private:
+ private:
ChunkCob chunkCob_;
TemporaryFile file_;
return alloc_ == other.alloc_;
}
-private:
+ private:
Alloc alloc_;
};
*/
template <class T>
class SharedPromise {
-public:
+ public:
SharedPromise() = default;
~SharedPromise() = default;
bool isFulfilled();
-private:
+ private:
std::mutex mutex_;
size_t size_{0};
bool hasValue_{false};
/// For best results, use an "enum class" for Enum.
template <class Enum>
class FSM {
-private:
+ private:
// I am not templatizing this because folly::MicroSpinLock needs to be
// zero-initialized (or call init) which isn't generic enough for something
// that behaves like std::mutex. :(
// An optimization would be to use a static conditional on the Enum type.
std::atomic<Enum> state_;
-public:
+ public:
explicit FSM(Enum startState) : state_(startState) {}
Enum getState() const noexcept {
}
class SomeClass {
-public:
+ public:
template <class Ret, class... Params>
static
typename std::enable_if<!isFuture<Ret>::value, Ret>::type
namespace gen {
class Less {
-public:
+ public:
template <class First, class Second>
auto operator()(const First& first, const Second& second) const ->
decltype(first < second) {
};
class Greater {
-public:
+ public:
template <class First, class Second>
auto operator()(const First& first, const Second& second) const ->
decltype(first > second) {
template <int n>
class Get {
-public:
+ public:
template <class Value>
auto operator()(Value&& value) const ->
decltype(std::get<n>(std::forward<Value>(value))) {
};
class Move {
-public:
+ public:
template <class Value>
auto operator()(Value&& value) const ->
decltype(std::move(std::forward<Value>(value))) {
static_assert(std::is_same<const Value&, ConstRefType>::value,
"Only matching types may be interleaved");
- public:
+
+ public:
explicit Generator(Source source,
const std::shared_ptr<const Container> container)
: source_(std::move(source)),
Generator<Value1,Source,Value2,Result>> {
Source source_;
const std::shared_ptr<const Container> container_;
- public:
+
+ public:
explicit Generator(Source source,
const std::shared_ptr<const Container> container)
: source_(std::move(source)),
static constexpr bool testArgs(...) {
return false;
}
-public:
+
+ public:
static constexpr bool value = testArgs<Candidate>(nullptr);
};
Chain<Value, First, Second>> {
First first_;
Second second_;
-public:
+
+ public:
explicit Chain(First first, Second second)
: first_(std::move(first))
, second_(std::move(second)) {}
}
};
- public:
+ public:
Generator(Source source, const Predicate& pred, size_t nThreads)
: source_(std::move(source)),
pred_(pred),
*/
class RemoteAcceptor
: private NotificationQueue<QueueMessage>::Consumer {
- public:
+ public:
explicit RemoteAcceptor(AcceptCallback *callback,
ConnectionEventCallback *connectionEventCallback)
: callback_(callback),
return &queue_;
}
- private:
+ private:
AcceptCallback *callback_;
ConnectionEventCallback* connectionEventCallback_;
callback_();
}
-private:
+ private:
TCallback callback_;
};
class WriteCallbackBase :
public AsyncTransportWrapper::WriteCallback {
-public:
+ public:
explicit WriteCallbackBase(SendMsgParamsCallbackBase* mcb = nullptr)
: state(STATE_WAITING)
, bytesWritten(0)
class ExpectWriteErrorCallback :
public WriteCallbackBase {
-public:
+ public:
explicit ExpectWriteErrorCallback(SendMsgParamsCallbackBase* mcb = nullptr)
: WriteCallbackBase(mcb) {}
};
class WriteCheckTimestampCallback :
- public WriteCallbackBase {
-public:
+ public WriteCallbackBase {
+ public:
explicit WriteCheckTimestampCallback(SendMsgParamsCallbackBase* mcb = nullptr)
: WriteCallbackBase(mcb) {}
};
class ReadCallback : public ReadCallbackBase {
-public:
+ public:
explicit ReadCallback(WriteCallbackBase *wcb)
: ReadCallbackBase(wcb)
, buffers() {}
}
class Buffer {
- public:
+ public:
Buffer() : buffer(nullptr), length(0) {}
Buffer(char* buf, size_t len) : buffer(buf), length(len) {}
};
class ReadErrorCallback : public ReadCallbackBase {
-public:
+ public:
explicit ReadErrorCallback(WriteCallbackBase *wcb)
: ReadCallbackBase(wcb) {}
};
class WriteErrorCallback : public ReadCallback {
-public:
+ public:
explicit WriteErrorCallback(WriteCallbackBase *wcb)
: ReadCallback(wcb) {}
};
class EmptyReadCallback : public ReadCallback {
-public:
+ public:
explicit EmptyReadCallback()
: ReadCallback(nullptr) {}
class HandshakeCallback :
public AsyncSSLSocket::HandshakeCB {
-public:
+ public:
enum ExpectType {
EXPECT_SUCCESS,
EXPECT_ERROR
};
class SSLServerAcceptCallback: public SSLServerAcceptCallbackBase {
-public:
+ public:
uint32_t timeout_;
explicit SSLServerAcceptCallback(HandshakeCallback *hcb,
};
class SSLServerAcceptCallbackDelay: public SSLServerAcceptCallback {
-public:
+ public:
explicit SSLServerAcceptCallbackDelay(HandshakeCallback *hcb):
SSLServerAcceptCallback(hcb) {}
};
class SSLServerAsyncCacheAcceptCallback: public SSLServerAcceptCallback {
-public:
+ public:
explicit SSLServerAsyncCacheAcceptCallback(HandshakeCallback *hcb,
uint32_t timeout = 0):
SSLServerAcceptCallback(hcb, timeout) {}
class HandshakeErrorCallback: public SSLServerAcceptCallbackBase {
-public:
+ public:
explicit HandshakeErrorCallback(HandshakeCallback *hcb):
SSLServerAcceptCallbackBase(hcb) {}
};
class HandshakeTimeoutCallback: public SSLServerAcceptCallbackBase {
-public:
+ public:
explicit HandshakeTimeoutCallback(HandshakeCallback *hcb):
SSLServerAcceptCallbackBase(hcb) {}
}
class PipeHandler : public EventHandler {
-public:
+ public:
PipeHandler(EventBase* eventBase, int fd)
: EventHandler(eventBase, fd) {}
}
class EventHandlerMock : public EventHandler {
-public:
+ public:
EventHandlerMock(EventBase* eb, int fd) : EventHandler(eb, fd) {}
// gmock can't mock noexcept methods, so we need an intermediary
MOCK_METHOD1(_handlerReady, void(uint16_t));
};
class EventHandlerTest : public Test {
-public:
+ public:
int efd = 0;
void SetUp() override {
namespace test {
class MockAsyncServerSocket : public AsyncServerSocket {
-public:
+ public:
typedef std::unique_ptr<MockAsyncServerSocket, Destructor> UniquePtr;
// We explicitly do not mock destroy(), since the base class implementation
}
}
-private:
+ private:
void printKV(const std::pair<const dynamic, dynamic>& p) const {
if (!opts_.allow_non_string_keys && !p.first.isString()) {
throw std::runtime_error("folly::toJson: JSON object key was not a "
out_ += ']';
}
-private:
+ private:
void outdent() const {
if (indentLevel_) {
--*indentLevel_;
out_ += indentLevel_ ? " : " : ":";
}
-private:
- std::string& out_;
- unsigned* const indentLevel_;
- serialization_opts const& opts_;
+ private:
+ std::string& out_;
+ unsigned* const indentLevel_;
+ serialization_opts const& opts_;
};
//////////////////////////////////////////////////////////////////////
current_ = range_.empty() ? EOF : range_.front();
}
-private:
+ private:
StringPiece range_;
json::serialization_opts const& opts_;
unsigned lineNum_;
IntegralSizePolicy() : size_(0) {}
- protected:
+ protected:
static constexpr std::size_t policyMaxSize() {
return SizeType(~kExternMask);
}
std::swap(size_, o.size_);
}
- protected:
+ protected:
static bool const kShouldUseHeap = ShouldUseHeap;
- private:
+ private:
static SizeType const kExternMask =
kShouldUseHeap ? SizeType(1) << (sizeof(SizeType) * 8 - 1)
: 0;
return (*this)[i];
}
-private:
-
+ private:
static iterator unconst(const_iterator it) {
return const_cast<iterator>(it);
}
}
}
-private:
+ private:
struct HeapPtrWithCapacity {
void* heap_;
InternalSizeType capacity_;
detail::growth_policy_wrapper<GrowthPolicy>&
get_growth_policy() { return *this; }
-public:
+ public:
typedef T value_type;
typedef T key_type;
typedef Compare key_compare;
return m_.cont_ < other.m_.cont_;
}
-private:
+ private:
/*
* This structure derives from the comparison object in order to
* make use of the empty base class optimization if our comparison
detail::growth_policy_wrapper<GrowthPolicy>&
get_growth_policy() { return *this; }
-public:
+ public:
typedef Key key_type;
typedef Value mapped_type;
typedef std::pair<key_type,mapped_type> value_type;
return Compare::operator()(a.first, b.first);
}
- protected:
+ protected:
friend class sorted_vector_map;
explicit value_compare(const Compare& c) : Compare(c) {}
};
return m_.cont_ < other.m_.cont_;
}
-private:
+ private:
// This is to get the empty base optimization; see the comment in
// sorted_vector_set.
struct EBO : value_compare {
GuardObj(const GuardObj&) = delete;
GuardObj& operator=(const GuardObj&) = delete;
-private:
+ private:
F f_;
Tuple args_;
};
unsigned count() const { return count_; }
-private:
+ private:
unsigned count_;
};
counter_.decrease();
}
-private:
+ private:
global_counter& counter_;
};
}
class Counters {
-private:
+ private:
// Note: Unfortunately can't currently put a std::atomic<int64_t> in
// the value in ahm since it doesn't support types that are both non-copy
// and non-move constructible yet.
AtomicHashMap<int64_t,int64_t> ahm;
-public:
+ public:
explicit Counters(size_t numCounters) : ahm(numCounters) {}
void increment(int64_t obj_id) {
template <class T>
class VectorWrapper {
-public:
+ public:
using value_type = T;
vector<T>& underlying;
explicit VectorWrapper(vector<T>& v) : underlying(v) {}
}
class MoveTester {
-public:
+ public:
/* implicit */ MoveTester(const char* s) : s_(s) {}
MoveTester(const MoveTester&) = default;
MoveTester(MoveTester&& other) noexcept {
other.s_ = "";
return *this;
}
-private:
+
+ private:
friend bool operator==(const MoveTester& o1, const MoveTester& o2);
std::string s_;
};
}
class Foo {
-public:
+ public:
Foo() {}
~Foo() {
try {
Data& operator=(const Data&) = default;
Data& operator=(Data&&) = default;
-private:
+ private:
int operator&() const;
};
typedef typename Vector::size_type size_type;
size_type size_;
int* data_;
-public:
+
+ public:
/* implicit */ DataState(const Vector& v) {
size_ = v.size();
if (size_ != 0) {
friend class boost::iterator_core_access;
shared_ptr<set<It>> dereferenced;
-public:
+ public:
explicit Transformer(const It& it)
: Transformer::iterator_adaptor_(it)
, dereferenced(new set<It>()) {}