Skip to content

Commit

Permalink
Repalces c array with strong type c++ equivalents.
Browse files Browse the repository at this point in the history
  • Loading branch information
rrahn committed Jul 25, 2024
1 parent 58f5485 commit 371d15c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/seqan3/alignment/matrix/detail/trace_directions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#pragma once

#include <array>
#include <string_view>

#include <seqan3/core/add_enum_bitwise_operators.hpp>
#include <seqan3/core/debug_stream/debug_stream_type.hpp>

Expand Down Expand Up @@ -77,12 +80,12 @@ struct trace_directions_printer<trace_directions_t>
{
private:
//!\brief The unicode representation of the trace directions.
static constexpr char const * unicode[32]{
static constexpr std::array<std::string_view, 32> unicode{
"", "", "", "↖↑", "", "↖⇡", "↑⇡", "↖↑⇡", "", "↖←", "↑←", "↖↑←", "⇡←", "↖⇡←", "↑⇡←", "↖↑⇡←",
"", "↖⇠", "↑⇠", "↖↑⇠", "⇡⇠", "↖⇡⇠", "↑⇡⇠", "↖↑⇡⇠", "←⇠", "↖←⇠", "↑←⇠", "↖↑←⇠", "⇡←⇠", "↖⇡←⇠", "↑⇡←⇠", "↖↑⇡←⇠"};

//!\brief The ascii representation of the trace directions.
static constexpr char const * csv[32]{
static constexpr std::array<std::string_view, 32> csv{
"N", "D", "U", "DU", "u", "Du", "Uu", "DUu", "L", "DL", "UL", "DUL", "uL", "DuL", "UuL", "DUuL",
"l", "Dl", "Ul", "DUl", "ul", "Dul", "Uul", "DUul", "Ll", "DLl", "ULl", "DULl", "uLl", "DuLl", "UuLl", "DUuLl"};

Expand Down Expand Up @@ -136,7 +139,7 @@ struct trace_directions_printer<trace_directions_t>
template <typename stream_t>
constexpr void print_impl(stream_t & stream, fmtflags2 const flag, detail::trace_directions const trace) const
{
bool is_unicode = (flag & fmtflags2::utf8) == fmtflags2::utf8;
bool const is_unicode = (flag & fmtflags2::utf8) == fmtflags2::utf8;
auto const & trace_dir = is_unicode ? unicode : csv;

stream << trace_dir[static_cast<size_t>(trace)];
Expand Down

0 comments on commit 371d15c

Please sign in to comment.