File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ TOML_NAMESPACE_START
237
237
// / \returns The specified line, excluding any possible trailing carriage return or line feed character.
238
238
// / \remarks Returns an empty string_view when there is no line at the specified line number, in the specified document.
239
239
TOML_NODISCARD
240
- inline std::string_view get_line (std::string_view doc, source_index line_num) noexcept
240
+ constexpr std::string_view get_line (std::string_view doc, source_index line_num) noexcept
241
241
{
242
242
if (line_num == 0 )
243
243
{
Original file line number Diff line number Diff line change @@ -454,7 +454,11 @@ b = []
454
454
455
455
SECTION (" tomlplusplus/issues/254" ) // https://github.com/marzer/tomlplusplus/issues/254
456
456
{
457
- for (const toml::source_index line_num: { 0u , 1u , 2u })
457
+ // Check constexpr support.
458
+ static_assert (toml::get_line (" " sv, 1 ) == std::string_view{});
459
+ static_assert (toml::get_line (" alpha = 1\n beta = 2\n # last line # " sv, 1 ) == " alpha = 1" sv);
460
+
461
+ for (const toml::source_index line_num : { 0u , 1u , 2u })
458
462
{
459
463
CHECK (toml::get_line (" " sv, line_num) == std::string_view{});
460
464
}
Original file line number Diff line number Diff line change @@ -2636,7 +2636,7 @@ TOML_NAMESPACE_START
2636
2636
};
2637
2637
2638
2638
TOML_NODISCARD
2639
- inline std::string_view get_line (std::string_view doc, source_index line_num) noexcept
2639
+ constexpr std::string_view get_line (std::string_view doc, source_index line_num) noexcept
2640
2640
{
2641
2641
if (line_num == 0 )
2642
2642
{
You can’t perform that action at this time.
0 commit comments