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*);
};
} // namespace sample

Definition at line 26 of file select.hpp.

Public Member Functions

constexpr SelectValueForLibCpp64 (T value) noexcept
 
constexpr SelectValueForLibStdCpp64 (T value) noexcept
 
constexpr SelectValueForLibCpp32 (T value) noexcept
 
constexpr SelectValueForLibStdCpp32 (T value) noexcept
 
constexpr SelectValueFor64Bit (T value) noexcept
 
constexpr SelectValueFor32Bit (T value) noexcept
 
constexpr operator T () const noexcept
 

Member Function Documentation

◆ For32Bit()

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

Definition at line 50 of file select.hpp.

◆ For64Bit()

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

Definition at line 46 of file select.hpp.

◆ ForLibCpp32()

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

Definition at line 38 of file select.hpp.

◆ ForLibCpp64()

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

Definition at line 30 of file select.hpp.

◆ ForLibStdCpp32()

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

Definition at line 42 of file select.hpp.

◆ ForLibStdCpp64()

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

Definition at line 34 of file select.hpp.

◆ operator T()

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

Definition at line 54 of file select.hpp.


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