Replace some std::string occurrences with std::string_view

std::string_view is more lightweight than std::string. Furthermore,
std::string_view variables can be declared constexpr.

closes https://github.com/official-stockfish/Stockfish/pull/4328

No functional change
This commit is contained in:
Sebastian Buchwald
2023-01-07 14:53:59 +01:00
committed by Joost VandeVondele
parent 5a88c5bb9b
commit e9e7a7b83f
4 changed files with 15 additions and 11 deletions
+2 -1
View File
@@ -22,6 +22,7 @@
#include <cstring> // For std::memset, std::memcmp
#include <iomanip>
#include <sstream>
#include <string_view>
#include "bitboard.h"
#include "misc.h"
@@ -46,7 +47,7 @@ namespace Zobrist {
namespace {
const string PieceToChar(" PNBRQK pnbrqk");
constexpr std::string_view PieceToChar(" PNBRQK pnbrqk");
constexpr Piece Pieces[] = { W_PAWN, W_KNIGHT, W_BISHOP, W_ROOK, W_QUEEN, W_KING,
B_PAWN, B_KNIGHT, B_BISHOP, B_ROOK, B_QUEEN, B_KING };