Commit c0909b44 authored by Alexander Zhavnerchik's avatar Alexander Zhavnerchik Committed by Facebook Github Bot

Fix operator->()

Summary:
According to http://en.cppreference.com/w/cpp/language/operators
  The overload of operator -> must either return a raw pointer or return an object (by reference or by value), for which operator -> is in turn overloaded.

Hence this change.

Reviewed By: mnv104

Differential Revision: D7548832

fbshipit-source-id: d98ff1f96bc00dc6e2e5cb084b96091a61421627
parent acd1c17a
......@@ -42,8 +42,8 @@ class SettingHandle {
const Type& operator*() const {
return core().get();
}
const Type& operator->() const {
return core().get();
const Type* operator->() const {
return &core().get();
}
/**
......
......@@ -63,6 +63,8 @@ TEST(Settings, basic) {
EXPECT_EQ(a_ns::a_func(), 1245);
EXPECT_EQ(b_ns::b_func(), "testbasdf");
EXPECT_EQ(*some_ns::SETTING_follytest_some_flag, "default");
EXPECT_EQ(
std::string(some_ns::SETTING_follytest_some_flag->c_str()), "default");
a_ns::SETTING_follytest_public_flag_to_a.set(100);
EXPECT_EQ(*a_ns::SETTING_follytest_public_flag_to_a, 100);
EXPECT_EQ(a_ns::getRemote(), 100);
......
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