Commit 4514c06c authored by Sara Golemon's avatar Sara Golemon

Change visibility of folly::Arena constructors to public

Summary: In the case of the copy constructor, this change
doesn't really matter, since it's deleted anyway.

In the case of the move constructor, it fixes what was probably
an unintentional hiding.  The class certainly looks like
it supports moving.

Closes #121

Reviewed By: @yfeldblum

Differential Revision: D2184131
parent 65eadfc8
...@@ -119,7 +119,6 @@ class Arena { ...@@ -119,7 +119,6 @@ class Arena {
return bytesUsed_; return bytesUsed_;
} }
private:
// not copyable // not copyable
Arena(const Arena&) = delete; Arena(const Arena&) = delete;
Arena& operator=(const Arena&) = delete; Arena& operator=(const Arena&) = delete;
...@@ -128,6 +127,7 @@ class Arena { ...@@ -128,6 +127,7 @@ class Arena {
Arena(Arena&&) = default; Arena(Arena&&) = default;
Arena& operator=(Arena&&) = default; Arena& operator=(Arena&&) = default;
private:
struct Block; struct Block;
typedef boost::intrusive::slist_member_hook< typedef boost::intrusive::slist_member_hook<
boost::intrusive::tag<Arena>> BlockLink; boost::intrusive::tag<Arena>> BlockLink;
......
...@@ -157,6 +157,17 @@ TEST(Arena, SizeLimit) { ...@@ -157,6 +157,17 @@ TEST(Arena, SizeLimit) {
EXPECT_THROW(arena.allocate(maxSize + 1), std::bad_alloc); EXPECT_THROW(arena.allocate(maxSize + 1), std::bad_alloc);
} }
TEST(Arena, MoveArena) {
SysArena arena(sizeof(size_t) * 2);
arena.allocate(sizeof(size_t));
auto totalSize = arena.totalSize();
auto bytesUsed = arena.bytesUsed();
SysArena moved(std::move(arena));
EXPECT_EQ(totalSize, moved.totalSize());
EXPECT_EQ(bytesUsed, moved.bytesUsed());
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
gflags::ParseCommandLineFlags(&argc, &argv, true); gflags::ParseCommandLineFlags(&argc, &argv, true);
......
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