TRLC Platform Library  1.0.0
Header-only C++ library for compile-time platform detection and abstraction
trlc::platform::CompilerVersion Struct Reference

#include <trlc/platform/compiler.hpp>

Static Public Member Functions

static CompilerVersion (int maj, int min, int pat=0)
 Constructs a compiler version. More...
 
static CompilerVersion ()
 Default constructor for unknown version. More...
 
static bool operator>= (const CompilerVersion &other) const
 
static bool operator< (const CompilerVersion &other) const
 Less than comparison. More...
 
static bool operator== (const CompilerVersion &other) const
 Equality comparison. More...
 
static bool operator!= (const CompilerVersion &other) const
 Inequality comparison. More...
 
static bool operator> (const CompilerVersion &other) const
 Greater than comparison. More...
 
static bool operator<= (const CompilerVersion &other) const
 Less than or equal comparison. More...
 

Public Attributes

int major
 Major version number (e.g., 9 in GCC 9.3.0) More...
 
int minor
 Minor version number (e.g., 3 in GCC 9.3.0) More...
 
int patch
 Patch version number (e.g., 0 in GCC 9.3.0) More...
 

Detailed Description

Examples
Version, and Version-dependent.

Definition at line 175 of file compiler.hpp.

Constructor & Destructor Documentation

◆ CompilerVersion() [1/2]

static trlc::platform::CompilerVersion::CompilerVersion ( int  maj,
int  min,
int  pat = 0 
)
inlinestatic

Constructs a compiler version.

Creates a CompilerVersion with the specified version components. The patch version defaults to 0 if not specified, which is common for version checks that only care about major.minor versions.

Parameters
majMajor version number
minMinor version number
patPatch version number (defaults to 0)
Note
This constructor is constexpr and can be used in compile-time contexts
Since
1.0.0

Definition at line 194 of file compiler.hpp.

◆ CompilerVersion() [2/2]

static trlc::platform::CompilerVersion::CompilerVersion ( )
inlinestatic

Default constructor for unknown version.

Creates a CompilerVersion with all components set to 0, indicating an unknown or undetectable compiler version.

Note
This constructor is constexpr and can be used in compile-time contexts
Since
1.0.0

Definition at line 206 of file compiler.hpp.

Member Function Documentation

◆ operator!=()

static bool trlc::platform::CompilerVersion::operator!= ( const CompilerVersion other) const
inlinestatic

Inequality comparison.

Checks if two compiler versions are not equal in any component. This is the logical negation of operator==().

Parameters
otherVersion to compare against
Returns
true if any version component differs
Note
This operator is constexpr and can be used in compile-time contexts
See also
operator==() for equality comparison
Since
1.0.0

Definition at line 291 of file compiler.hpp.

◆ operator<()

static bool trlc::platform::CompilerVersion::operator< ( const CompilerVersion other) const
inlinestatic

Less than comparison.

Compares two compiler versions using lexicographic ordering. Useful for checking if a compiler version is below a certain threshold or for compatibility with older compiler versions.

Parameters
otherVersion to compare against
Returns
true if this version < other (major.minor.patch ordering)
Note
This operator is constexpr and can be used in compile-time contexts
See also
operator>=() for greater-than-or-equal comparison
Since
1.0.0

Definition at line 252 of file compiler.hpp.

◆ operator<=()

static bool trlc::platform::CompilerVersion::operator<= ( const CompilerVersion other) const
inlinestatic

Less than or equal comparison.

Parameters
otherVersion to compare against
Returns
true if this version <= other

Definition at line 309 of file compiler.hpp.

◆ operator==()

static bool trlc::platform::CompilerVersion::operator== ( const CompilerVersion other) const
inlinestatic

Equality comparison.

Checks if two compiler versions are exactly equal in all components (major, minor, patch). Useful for compiler-specific workarounds or exact version matching.

Parameters
otherVersion to compare against
Returns
true if all version components are equal
Note
This operator is constexpr and can be used in compile-time contexts
See also
operator!=() for inequality comparison
Since
1.0.0

Definition at line 274 of file compiler.hpp.

◆ operator>()

static bool trlc::platform::CompilerVersion::operator> ( const CompilerVersion other) const
inlinestatic

Greater than comparison.

Parameters
otherVersion to compare against
Returns
true if this version > other

Definition at line 300 of file compiler.hpp.

◆ operator>=()

static bool trlc::platform::CompilerVersion::operator>= ( const CompilerVersion other) const
inlinestatic

Definition at line 230 of file compiler.hpp.

Member Data Documentation

◆ major

int trlc::platform::CompilerVersion::major

Major version number (e.g., 9 in GCC 9.3.0)

Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 176 of file compiler.hpp.

◆ minor

int trlc::platform::CompilerVersion::minor

Minor version number (e.g., 3 in GCC 9.3.0)

Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 177 of file compiler.hpp.

◆ patch

int trlc::platform::CompilerVersion::patch

Patch version number (e.g., 0 in GCC 9.3.0)

Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 178 of file compiler.hpp.


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