mirror of
https://github.com/mpusz/mp-units.git
synced 2025-06-25 01:01:33 +02:00
refactor: 💥 from now unit_symbol
and dimension_symbol
always returns std::string_view
This commit is contained in:
@ -19,7 +19,6 @@ C++ feature:
|
||||
| **`std::format`** | 20 | 13 | 17 | None | 194 |
|
||||
| **C++ modules** | 20 | None | 17 | None | None |
|
||||
| **`import std;`** | 23 | None | 18 | None | None |
|
||||
| **Static `constexpr` variables in `constexpr` functions** | 23 | 13 | 17 | None | None |
|
||||
| **Explicit `this` parameter** | 23 | 14 | 18 | None | None |
|
||||
|
||||
??? note "MSVC bugs"
|
||||
@ -87,20 +86,6 @@ C++ feature:
|
||||
- CMake: [CMAKE_CXX_MODULE_STD](https://cmake.org/cmake/help/latest/variable/CMAKE_CXX_MODULE_STD.html)
|
||||
|
||||
|
||||
## Static `constexpr` variables in `constexpr` functions
|
||||
|
||||
- Allows returning `std::string_view` from the
|
||||
[`unit_symbol()`](../users_guide/framework_basics/text_output.md#unit_symbol)
|
||||
and [`dimension_symbol()`](../users_guide/framework_basics/text_output.md#dimension_symbol)
|
||||
functions
|
||||
- `std::string_view` type has a reference semantics so it has to point to a storage with
|
||||
a longer lifetime.
|
||||
- If this feature is not available, the API returns `mp_units::basic_fixed_string<CharT, N>` instead.
|
||||
- Tested as `__cpp_constexpr >= 202211L` [feature test macro](https://en.cppreference.com/w/cpp/feature_test).
|
||||
- Related build options:
|
||||
- Conan: [string_view_ret](installation_and_usage.md#string_view_ret)
|
||||
- CMake: [MP_UNITS_API_STRING_VIEW_RET](installation_and_usage.md#MP_UNITS_API_STRING_VIEW_RET)
|
||||
|
||||
## Explicit `this` parameter
|
||||
|
||||
- This feature removes the need for the usage of the CRTP idiom in the
|
||||
|
@ -123,18 +123,6 @@ dependencies by other means, some modifications to the library's CMake files mig
|
||||
|
||||
[conan std::format support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0
|
||||
|
||||
[`string_view_ret`](#string_view_ret){ #string_view_ret }
|
||||
|
||||
: [:octicons-tag-24: 2.2.0][conan returning string_view] · :octicons-milestone-24: `True`/`False` (Default: automatically determined from settings)
|
||||
|
||||
Enables returning `std::string_view` from the
|
||||
[`unit_symbol()`](../users_guide/framework_basics/text_output.md#unit_symbol)
|
||||
and [`dimension_symbol()`](../users_guide/framework_basics/text_output.md#dimension_symbol)
|
||||
functions. If this feature is not available, those functions will return
|
||||
`mp_units::basic_fixed_string<CharT, N>` instead.
|
||||
|
||||
[conan returning string_view]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0
|
||||
|
||||
[`no_crtp`](#no_crtp){ #no_crtp }
|
||||
|
||||
: [:octicons-tag-24: 2.2.0][conan no crtp support] · :octicons-milestone-24: `True`/`False` (Default: automatically determined from settings)
|
||||
@ -196,18 +184,6 @@ dependencies by other means, some modifications to the library's CMake files mig
|
||||
|
||||
[cmake std::format support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0
|
||||
|
||||
[`MP_UNITS_API_STRING_VIEW_RET`](#MP_UNITS_API_STRING_VIEW_RET){ #MP_UNITS_API_STRING_VIEW_RET }
|
||||
|
||||
: [:octicons-tag-24: 2.2.0][cmake returning string_view] · :octicons-milestone-24: `ON`/`OFF` (Default: automatically determined)
|
||||
|
||||
Enables returning `std::string_view` from the
|
||||
[`unit_symbol()`](../users_guide/framework_basics/text_output.md#unit_symbol)
|
||||
and [`dimension_symbol()`](../users_guide/framework_basics/text_output.md#dimension_symbol)
|
||||
functions. If this feature is not available, those functions will return
|
||||
`mp_units::basic_fixed_string<CharT, N>` instead.
|
||||
|
||||
[cmake returning string_view]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0
|
||||
|
||||
[`MP_UNITS_API_NO_CRTP`](#MP_UNITS_API_NO_CRTP){ #MP_UNITS_API_NO_CRTP }
|
||||
|
||||
: [:octicons-tag-24: 2.2.0][cmake no crtp support] · :octicons-milestone-24: `ON`/`OFF` (Default: automatically determined)
|
||||
|
Reference in New Issue
Block a user