blob: 8d44f3f79131fff4db430d984406fb97fa0e0aae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
// *****************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under *
// * GNU General Public License: https://www.gnu.org/licenses/gpl-3.0 *
// * Copyright (C) Zenju (zenju AT freefilesync DOT org) - All Rights Reserved *
// *****************************************************************************
#ifndef LEGACY_COMPILER_H_839567308565656789
#define LEGACY_COMPILER_H_839567308565656789
//https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
//https://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros
//https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html
namespace std
{
//---------------------------------------------------------------------------------
#if __cpp_lib_span
#error get rid of workaround:
#endif
template <class T>
class span
{
public:
template <class Iterator>
span(Iterator first, Iterator last) : size_(last - first), data_(first != last ? &*first : nullptr) {}
template <class Container>
span(Container& cont) : span(cont.begin(), cont.end()) {}
using iterator = T*;
using const_iterator = const T*;
iterator begin() { return data_; }
iterator end () { return data_ + size_; }
const_iterator begin() const { return data_; }
const_iterator end () const { return data_ + size_; }
const_iterator cbegin() const { return begin(); }
const_iterator cend () const { return end (); }
T* data() const { return data_; }
size_t size() const { return size_; }
bool empty() const { return size_ == 0; }
private:
const size_t size_;
T* const data_;
};
#if __cpp_lib_math_constants
#error get rid of workaround:
#endif
namespace numbers
{
const double pi = 3.14159265358979323846;
const double e = 2.71828182845904523536;
const double sqrt2 = 1.41421356237309504880;
const double ln2 = 0.693147180559945309417;
}
}
namespace zen
{
double from_chars(const char* first, const char* last);
const char* to_chars(char* first, char* last, double num);
}
#endif //LEGACY_COMPILER_H_839567308565656789
|