mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-07 06:07:32 +02:00
scripted-diff: Use std::span over Span
-BEGIN VERIFY SCRIPT-
ren() { sed -i "s!\<$1\>!$2!g" $( git grep -l "$1" -- "./src" ":(exclude)src/span.h" ":(exclude)src/leveldb/db/log_test.cc" ) ; }
ren Span std::span
ren AsBytes std::as_bytes
ren AsWritableBytes std::as_writable_bytes
sed -i 's!SpanPopBack(Span!SpanPopBack(std::span!g' ./src/span.h
-END VERIFY SCRIPT-
This commit is contained in:
@@ -15,7 +15,7 @@ struct Ignore
|
||||
template<typename T> Ignore(T&&) {}
|
||||
};
|
||||
template<typename T>
|
||||
bool Spannable(T&& value, decltype(Span{value})* enable = nullptr)
|
||||
bool Spannable(T&& value, decltype(std::span{value})* enable = nullptr)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -42,9 +42,9 @@ using namespace spannable;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(span_tests)
|
||||
|
||||
// Make sure template Span template deduction guides accurately enable calls to
|
||||
// Span constructor overloads that work, and disable calls to constructor overloads that
|
||||
// don't work. This makes it is possible to use the Span constructor in a SFINAE
|
||||
// Make sure template std::span template deduction guides accurately enable calls to
|
||||
// std::span constructor overloads that work, and disable calls to constructor overloads that
|
||||
// don't work. This makes it is possible to use the std::span constructor in a SFINAE
|
||||
// contexts like in the Spannable function above to detect whether types are or
|
||||
// aren't compatible with Spans at compile time.
|
||||
BOOST_AUTO_TEST_CASE(span_constructor_sfinae)
|
||||
@@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(span_constructor_sfinae)
|
||||
BOOST_CHECK(!Spannable(std::set<int>{}));
|
||||
BOOST_CHECK(!Spannable(std::vector<bool>{}));
|
||||
BOOST_CHECK(Spannable(std::array<int, 3>{}));
|
||||
BOOST_CHECK(Spannable(Span<int>{}));
|
||||
BOOST_CHECK(Spannable(std::span<int>{}));
|
||||
BOOST_CHECK(Spannable("char array"));
|
||||
BOOST_CHECK(Spannable(SpannableYes{}));
|
||||
BOOST_CHECK(!Spannable(SpannableNo{}));
|
||||
|
||||
Reference in New Issue
Block a user