32 #ifndef Foam_stdFoam_H 33 #define Foam_stdFoam_H 36 #include <initializer_list> 40 #include <type_traits> 48 #define FOAM_DEPRECATED(since) [[deprecated("Since " #since)]] 49 #define FOAM_DEPRECATED_FOR(since, replacement) [[deprecated("Since " #since "; use " #replacement)]] 51 #ifdef FOAM_COMPILE_STRICT 52 # define FOAM_DEPRECATED_STRICT(since, replacement) [[deprecated("Since " #since "; use " #replacement)]] 53 # if (FOAM_COMPILE_STRICT > 1) 54 # define FOAM_DEPRECATED_STRICTER(since, replacement) [[deprecated("Since " #since "; use " #replacement)]] 58 #ifndef FOAM_DEPRECATED_STRICT 59 #define FOAM_DEPRECATED_STRICT(since, replacement) 61 #ifndef FOAM_DEPRECATED_STRICTER 62 #define FOAM_DEPRECATED_STRICTER(since, replacement) 66 #if defined(__GNUC__) || defined(__clang__) 67 # define FOAM_UNLIKELY(cond) __builtin_expect(!!(cond),0) 68 # define FOAM_LIKELY(cond) __builtin_expect(!!(cond),1) 70 # define FOAM_UNLIKELY(cond) (cond) 71 # define FOAM_LIKELY(cond) (cond) 76 #if defined(__GNUC__) && !defined(__llvm__) 77 # define FOAM_REAL_GNUC __GNUC__ 81 #if (FOAM_REAL_GNUC >= 14) 82 # define FOAM_NO_DANGLING_REFERENCE [[gnu::no_dangling]] 85 #ifndef FOAM_NO_DANGLING_REFERENCE 86 #define FOAM_NO_DANGLING_REFERENCE 112 return std::forward<T>(val);
119 return std::forward<T>(val);
140 template<
class T,
size_t N>
143 for (
size_t i = 0; i <
N; ++i)
168 template<
typename...>
185 #define forAllIters(container,iter) \ 188 auto iter = std::begin(container); \ 189 iter != std::end(container); \ 203 #define forAllConstIters(container,iter) \ 206 auto iter = std::cbegin(container); \ 207 iter != std::cend(container); \ 222 #define forAllReverseIters(container,iter) \ 225 auto iter = std::rbegin(container); \ 226 iter != std::rend(container); \ 240 #define forAllConstReverseIters(container,iter) \ 243 auto iter = std::crbegin(container); \ 244 iter != std::crend(container); \ 258 #define forAll(list, i) \ 259 for (Foam::label i=0; i<(list).size(); ++i) 271 #define forAllReverse(list, i) \ 272 for (Foam::label i=(list).size()-1; i>=0; --i) 287 #define forAllIter(Container,container,iter) \ 290 Container::iterator iter = (container).begin(); \ 291 iter != (container).end(); \ 306 #define forAllConstIter(Container,container,iter) \ 309 Container::const_iterator iter = (container).cbegin(); \ 310 iter != (container).cend(); \ 341 using element_type = Type;
342 using value_type = std::remove_cv_t<Type>;
344 using difference_type = std::ptrdiff_t;
345 using pointer = Type*;
346 using const_pointer =
const Type*;
347 using reference = element_type&;
348 using const_reference =
const element_type&;
349 using iterator = Type*;
355 span(
const span& other)
noexcept =
default;
358 span& operator=(
const span& other)
noexcept =
default;
378 constexpr span(pointer first, pointer last)
noexcept 397 constexpr iterator
end() const
noexcept {
return (data_ + size_); }
403 constexpr reference front()
const {
return *(data_); }
406 constexpr reference back()
const {
return *(data_ + size_ - 1); }
409 constexpr reference operator[](
size_type idx)
const 411 return *(data_ + idx);
426 return (size_*
sizeof(Type));
430 constexpr
bool empty() const
noexcept {
return !size_; }
450 return span<Type>(data_ +
pos, size_ -
pos);
465 constexpr
const char* cdata_bytes() const
noexcept 467 return reinterpret_cast<const char*
>(data_);
472 template<
class TypeT = Type>
473 std::enable_if_t<!std::is_const_v<TypeT>,
char*>
476 return reinterpret_cast<char*
>(data_);
constexpr T && operator[](T &&val) const noexcept
dimensionedScalar pos(const dimensionedScalar &ds)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
graph_traits< Graph >::vertices_size_type size_type
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
constexpr bool dependent_false_v
Map any dependent type to false (workaround before CWG2518)
A functor that returns its argument unchanged (cf. C++20 std::identity) Should never be specialized...
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
const Vector< label > N(dict.get< Vector< label >>("N"))
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
Exchange contents of lists - see DynamicList::swap().
Rudimentary functionality similar to std::span for holding memory view.
Namespace for std templates that are are part of future C++ standards or that are in a state of chang...
constexpr T && operator()(T &&val) const noexcept