Commit c9bd77f1 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Avoid overloading other names from within detail namespaces

Summary: [Folly] Avoid overloading other names from within detail namespaces - prefer renaming or at least mangling.

Reviewed By: Orvid

Differential Revision: D18502700

fbshipit-source-id: a4f455db69396962b298c6291929f1eb152e1576
parent 6f5a64d6
......@@ -60,7 +60,7 @@ constexpr array_detail::return_type<D, TList...> make_array(TList&&... t) {
namespace array_detail {
template <typename MakeItem, std::size_t... Index>
FOLLY_ERASE constexpr auto make_array_with(
FOLLY_ERASE constexpr auto make_array_with_(
MakeItem const& make,
std::index_sequence<Index...>) {
return std::array<decltype(make(0)), sizeof...(Index)>{{make(Index)...}};
......@@ -72,7 +72,7 @@ FOLLY_ERASE constexpr auto make_array_with(
// Constructs a std::array<..., Size> with elements m(i) for i in [0, Size).
template <std::size_t Size, typename MakeItem>
constexpr auto make_array_with(MakeItem const& make) {
return array_detail::make_array_with(make, std::make_index_sequence<Size>{});
return array_detail::make_array_with_(make, std::make_index_sequence<Size>{});
}
} // namespace folly
......@@ -77,10 +77,8 @@ TEST(make_array_with, example) {
return index + 4;
}
};
using folly::make_array_with;
using folly::array_detail::make_array_with; // should not collide
constexpr auto actual = make_array_with<3>(make_item{});
constexpr auto actual = folly::make_array_with<3>(make_item{});
constexpr auto expected = make_array<int>(4, 5, 6);
EXPECT_EQ(expected, actual);
}
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