Did you remember to set /std:c++20 for all platform/configuration conbinations? If you did not it's possible that what you see for your project is because the platform/configuration that you're looking at doesn't have the proper setting.
How to use c++ thingie called “Span”
Windows 11, Visual Studio 2019, C++, Base58 encoder
I am trying to incorporate functions to do Base58 encoding and decoding. They are widely used by Bitcoin.
The code I am trying is here: https://github.com/bitcoin/bitcoin/blob/master/src/base58.cpp
I have added several includes and down to one error in three places. Example:
std::string EncodeBase58(Span<const unsigned char> input)
I have gone through several variations to include std::span and gsl::span and none are accepted. I “think” I can remove it by replacing the argument with the specified array plus a size_t argument for the size. But, I would like to keep it as is.
What is the right configuration for VS 2019 C++?
PS: The tool to add a hyperlink uses http:// Maybe update it to https://
Developer technologies | C++
8 additional answers
Sort by: Most helpful
-
RLWA32 49,551 Reputation points
2022-10-29T20:12:05.663+00:00 C++ is case sensitive. Use span, not Span.
-
Marius H 1 Reputation point
2022-10-29T03:21:24.58+00:00 They use their own implementation located at bitcoin/blob/master/src/span.h.
-
Bryan Kelly 486 Reputation points
2022-10-29T03:51:30.58+00:00 Well now.
I read that using span reduces argument from something like:function( &array, size )
to
function( span<type> input );But after seeing all that code, I wonder if it is really worth that much effort.
Some advantages are described in some web pages, but I lack the experience to understand the significant improvement.Thank you for the info.
-
Bryan Kelly 486 Reputation points
2022-10-29T19:49:17.757+00:00 I am running VS 2019 version 16.11.20.
from this page: msvcs-stl-completes-stdc20and this quote:
We previously announced that MSVC had completed all features in C++20 for Visual Studio version 16.11.0, and that we had added the /std:c++20 option to indicate that most C++20 features were stabilized and considered production-ready.
And from a few searches it seems that the "span" feature is part of C++20. But my VS is not recognizing the key word span. Below are a few lines from a dot h file.
What steps are needed to recognize this feature?