Apply clang-format to the changed code
This commit is contained in:
parent
a018b09aab
commit
fc7e7baed7
@ -3420,15 +3420,14 @@ arg_join<It, Sentinel, wchar_t> join(It begin, Sentinel end, wstring_view sep) {
|
|||||||
\endrst
|
\endrst
|
||||||
*/
|
*/
|
||||||
template <typename Range>
|
template <typename Range>
|
||||||
arg_join<detail::iterator_t<Range>, detail::sentinel_t<Range>, char>
|
arg_join<detail::iterator_t<Range>, detail::sentinel_t<Range>, char> join(
|
||||||
join(Range&& range, string_view sep) {
|
Range&& range, string_view sep) {
|
||||||
return join(std::begin(range), std::end(range), sep);
|
return join(std::begin(range), std::end(range), sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Range>
|
template <typename Range>
|
||||||
arg_join<detail::iterator_t<Range>, detail::sentinel_t<Range>,
|
arg_join<detail::iterator_t<Range>, detail::sentinel_t<Range>, wchar_t> join(
|
||||||
wchar_t>
|
Range&& range, wstring_view sep) {
|
||||||
join(Range&& range, wstring_view sep) {
|
|
||||||
return join(std::begin(range), std::end(range), sep);
|
return join(std::begin(range), std::end(range), sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -154,38 +154,36 @@ TEST(RangesTest, JoinSentinel) {
|
|||||||
EXPECT_EQ("h_e_l_l_o", fmt::format("{}", fmt::join(hello, "_")));
|
EXPECT_EQ("h_e_l_l_o", fmt::format("{}", fmt::join(hello, "_")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// A range that provides non-const only begin()/end() to test fmt::join handles that
|
// A range that provides non-const only begin()/end() to test fmt::join handles
|
||||||
|
// that
|
||||||
//
|
//
|
||||||
// Some ranges (eg those produced by range-v3's views::filter()) can cache information
|
// Some ranges (eg those produced by range-v3's views::filter()) can cache
|
||||||
// during iteration so they only provide non-const begin()/end().
|
// information during iteration so they only provide non-const begin()/end().
|
||||||
template <typename T>
|
template <typename T> class non_const_only_range {
|
||||||
class non_const_only_range {
|
private:
|
||||||
private:
|
std::vector<T> vec;
|
||||||
std::vector<T> vec;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using const_iterator = typename ::std::vector<T>::const_iterator;
|
using const_iterator = typename ::std::vector<T>::const_iterator;
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
explicit non_const_only_range(Args &&...args) : vec( ::std::forward<Args>( args )... ) {}
|
explicit non_const_only_range(Args&&... args)
|
||||||
|
: vec(::std::forward<Args>(args)...) {}
|
||||||
|
|
||||||
const_iterator begin() {
|
const_iterator begin() { return vec.begin(); }
|
||||||
return vec.begin();
|
const_iterator end() { return vec.end(); }
|
||||||
}
|
|
||||||
const_iterator end() {
|
|
||||||
return vec.end();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(RangesTest, JoinRange) {
|
TEST(RangesTest, JoinRange) {
|
||||||
non_const_only_range<int> x( 3, 0 );
|
non_const_only_range<int> x(3, 0);
|
||||||
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(x, ",")));
|
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(x, ",")));
|
||||||
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(non_const_only_range<int>( 3, 0 ), ",")));
|
EXPECT_EQ("0,0,0",
|
||||||
|
fmt::format("{}", fmt::join(non_const_only_range<int>(3, 0), ",")));
|
||||||
|
|
||||||
std::vector<int> y( 3, 0 );
|
std::vector<int> y(3, 0);
|
||||||
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(y, ",")));
|
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(y, ",")));
|
||||||
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(std::vector<int>( 3, 0 ), ",")));
|
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(std::vector<int>(3, 0), ",")));
|
||||||
|
|
||||||
const std::vector<int> z( 3, 0 );
|
const std::vector<int> z(3, 0);
|
||||||
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(z, ",")));
|
EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(z, ",")));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user