userver: compiler::SelectValue< T > Class Template Reference
Loading...
Searching...
No Matches
compiler::SelectValue< T > Class Template Referencefinal

#include <userver/compiler/select.hpp>

Detailed Description

template<typename T>
class compiler::SelectValue< T >

Selects the proper value for the current compiler and standard library.

If proper value for the standard library was set, prefers it over the generic x32/x64 values.

Example usage:

#pragma once
namespace sample {
class Widget {
public:
Widget();
Widget(Widget&& other) noexcept;
Widget(const Widget& other);
Widget& operator=(Widget&& other) noexcept;
Widget& operator=(const Widget& other);
~Widget();
int DoSomething(short param);
private:
struct Impl;
static constexpr std::size_t kImplSize = compiler::SelectSize().For64Bit(8).For32Bit(4);
static constexpr std::size_t kImplAlign = alignof(void*);
utils::FastPimpl<Impl, kImplSize, kImplAlign, utils::kStrictMatch> pimpl_;
};
} // namespace sample

Definition at line 26 of file select.hpp.

Public Member Functions

constexpr SelectValue & ForLibCpp64 (T value) noexcept
constexpr SelectValue & ForLibStdCpp64 (T value) noexcept
constexpr SelectValue & ForLibCpp32 (T value) noexcept
constexpr SelectValue & ForLibStdCpp32 (T value) noexcept
constexpr SelectValue & For64Bit (T value) noexcept
constexpr SelectValue & For32Bit (T value) noexcept
constexpr operator T () const noexcept

Member Function Documentation

◆ For32Bit()

template<typename T>
SelectValue & compiler::SelectValue< T >::For32Bit ( T value)
inlineconstexprnoexcept

Definition at line 40 of file select.hpp.

◆ For64Bit()

template<typename T>
SelectValue & compiler::SelectValue< T >::For64Bit ( T value)
inlineconstexprnoexcept

Definition at line 38 of file select.hpp.

◆ ForLibCpp32()

template<typename T>
SelectValue & compiler::SelectValue< T >::ForLibCpp32 ( T value)
inlineconstexprnoexcept

Definition at line 34 of file select.hpp.

◆ ForLibCpp64()

template<typename T>
SelectValue & compiler::SelectValue< T >::ForLibCpp64 ( T value)
inlineconstexprnoexcept

Definition at line 30 of file select.hpp.

◆ ForLibStdCpp32()

template<typename T>
SelectValue & compiler::SelectValue< T >::ForLibStdCpp32 ( T value)
inlineconstexprnoexcept

Definition at line 36 of file select.hpp.

◆ ForLibStdCpp64()

template<typename T>
SelectValue & compiler::SelectValue< T >::ForLibStdCpp64 ( T value)
inlineconstexprnoexcept

Definition at line 32 of file select.hpp.

◆ operator T()

template<typename T>
compiler::SelectValue< T >::operator T ( ) const
inlineconstexprnoexcept

Definition at line 42 of file select.hpp.


The documentation for this class was generated from the following file: