Add some constexpr to some functions

master
Tomasz Golinski 2023-09-25 18:35:05 +02:00
rodzic 48f92e64d8
commit 816c94049a
2 zmienionych plików z 5 dodań i 11 usunięć

Wyświetl plik

@ -5,11 +5,6 @@
#include <algorithm>
#include <numeric>
#include <iterator>
#include <cmath>
float degtorad(float x) {
return x * M_PI / 180;
}
void htmlencode(std::string& data) {
std::string tmp;
@ -41,7 +36,7 @@ void htmlencode(std::string& data) {
data.swap(tmp);
}
static std::string string_mangle(const std::string& str) {
constexpr static std::string string_mangle(const std::string& str) {
std::string tmp;
tmp.reserve(str.size());

Wyświetl plik

@ -1,13 +1,11 @@
#pragma once
// #include "cache.h"
// #include "powertrail.h"
#include <functional>
#include <string>
#include <map>
#include <vector>
#include <ctime>
#include <cmath>
class Cache;
@ -68,7 +66,8 @@ public:
explicit Position(std::string loc);
};
float cache_distance(const Cache& a, const Cache& b);
float degtorad(float x);
constexpr float degtorad(float x) {
return x * M_PI / 180;
}