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

View File

@@ -18,11 +18,12 @@
// Code for calculating NNUE evaluation function
#include <fstream>
#include <iomanip>
#include <iostream>
#include <set>
#include <sstream>
#include <iomanip>
#include <fstream>
#include <string_view>
#include "../evaluate.h"
#include "../position.h"
@@ -210,7 +211,7 @@ namespace Stockfish::Eval::NNUE {
return t;
}
static const std::string PieceToChar(" PNBRQK pnbrqk");
constexpr std::string_view PieceToChar(" PNBRQK pnbrqk");
// format_cp_compact() converts a Value into (centi)pawns and writes it in a buffer.