Commit 7ee12309 authored by Phil Willoughby's avatar Phil Willoughby Committed by Facebook Github Bot

relax requirements on join wrapper template

Summary: The template that this template wraps requires only forward iterators, so it doesn't make sense for the wrapper to be stricter than that.

Reviewed By: yfeldblum

Differential Revision: D6988987

fbshipit-source-id: 575dcacf7b1873ea0d7112acf84670842ee82fa7
parent ac3169a8
...@@ -534,9 +534,10 @@ std::string join(const Delim& delimiter, ...@@ -534,9 +534,10 @@ std::string join(const Delim& delimiter,
template < template <
class Delim, class Delim,
class Iterator, class Iterator,
typename std::enable_if<std::is_same< typename std::enable_if<std::is_base_of<
typename std::iterator_traits<Iterator>::iterator_category, std::forward_iterator_tag,
std::random_access_iterator_tag>::value>::type* = nullptr> typename std::iterator_traits<Iterator>::iterator_category>::value>::
type* = nullptr>
std::string join(const Delim& delimiter, Iterator begin, Iterator end) { std::string join(const Delim& delimiter, Iterator begin, Iterator end) {
std::string output; std::string output;
join(delimiter, begin, end, output); join(delimiter, begin, end, output);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <folly/String.h> #include <folly/String.h>
#include <cinttypes> #include <cinttypes>
#include <set>
#include <boost/regex.hpp> #include <boost/regex.hpp>
...@@ -993,6 +994,12 @@ TEST(String, join) { ...@@ -993,6 +994,12 @@ TEST(String, join) {
output = join("", input3.begin(), input3.end()); output = join("", input3.begin(), input3.end());
EXPECT_EQ(output, "facebook"); EXPECT_EQ(output, "facebook");
std::multiset<char> input4(input3);
output = join("", input4);
EXPECT_EQ("abcefkoo", output);
output = join("", input4.begin(), input4.end());
EXPECT_EQ("abcefkoo", output);
} }
TEST(String, hexlify) { TEST(String, hexlify) {
......
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