I have a situation where a function should return a value taken from a table. A cell in this table (let's say the table just works ...) may or may not contain a value. This value can also be one of several types: int, double, string, date(but of a different type).
int, double, string, date
What would return such a function? Is it a good idea to come back std::optional<std::variant<std::string, int, double, std::chrono::time_point>>?
std::optional<std::variant<std::string, int, double, std::chrono::time_point>>
Is it good to use optionaland variant?
optional
variant
, std::monostate. , variant<std::monostate, int, double, std::string, std::chrono::time_point>. monostate , a variant .
std::monostate
variant<std::monostate, int, double, std::string, std::chrono::time_point>
monostate
, optional<variant> , . , monostate, visit "" .
optional<variant>
visit
Source: https://habr.com/ru/post/1017357/More articles:Какие системные модули по умолчанию находятся на пути к модулю? - javaWhat happens when I create a list, such as c = [1] in python, in terms of name object bindings? - pythonWhy can Groovy constants be increased? - debuggingVisual Studio 2017 Angular 4 шаблона - angularPython Are name bindings not object references? - pythonFailed to load file or assembly "System.ComponentModel.Annotations, Version = 4.1.0.0 - .netFailed to load file or assembly. Microsoft.Extensions.DependencyInjection.Abstractions, Version = 1.1.0.0 - c #When using .Net Standard 1.4 in the library and .Net framework 4.6.1 in the application and the application, the file System.IO.FileSystem, Version = 4.0.1.0 - c #Android - displaying ExoPlayer in a circle - androidhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1017362/jupyter-client-has-to-be-installed-but-jupyter-kernelspec-version-exited-with-code-127&usg=ALkJrhjVizjypgkErHkVz9XfO4Qzo9lC3gAll Articles