Corelink CPP Client
Corelink C++ client library
 
Loading...
Searching...
No Matches
corelink Namespace Reference

Namespaces

namespace  client
 
namespace  commons
 
namespace  core
 
namespace  utils
 

Typedefs

template<typename t >
using ptr = t *
 Typedef native pointer type.
 
template<typename t >
using ptr_to_const_val = t const *
 Typedef native pointer-to-const-value type.
 
template<typename t >
using const_ptr_to_val = t *const
 Typedef native const-pointer-to-value type.
 
template<typename t >
using const_ptr_to_const_val = const t *const
 Defines a constant pointer type to a constant value.
 
template<typename t >
using fref = t &&
 Forwarding reference.
 
template<typename t >
using rvref = fref<t &&>
 R-value reference typedef Example.
 
template<typename t >
using lvref = fref<t &>
 L-value reference typedef. equivalent to type &var Example.
 
template<typename t >
using clvref = fref<const t &>
 const l-value reference typedef.
 
template<typename t >
using in = clvref<t>
 Wraps a type and declares a value as an in parameter, which is a clvref.
 
template<typename t >
using out = lvref<t>
 Wraps a type and declares a value as an out parameter, which is a lvref.
 

Detailed Description

Root namespace for everything corelink. All modules are in nested namespaces

Typedef Documentation

◆ clvref

template<typename t >
using corelink::clvref = fref<const t &>

const l-value reference typedef.

Template Parameters
tnative or secondary type

usage: clvref<type> var. equivalent to const type &var Example

{
// ...
}
...
foo("Hello"); // OK
std::string b = "Bye";
foo(b); // OK

◆ const_ptr_to_const_val

template<typename t >
using corelink::const_ptr_to_const_val = const t *const

Defines a constant pointer type to a constant value.

Template Parameters
ttype of pointer

Equivalent expansion would be const t *const val Example:

int a = 10;
int b = 11;
const_ptr_to_const_val<int> p = &a; // eq. to const int const *b = &a;
// *p = 12; // illegal. will generate compiler error
// p = &b; // illegal. will generate compiler error

◆ const_ptr_to_val

template<typename t >
using corelink::const_ptr_to_val = t *const

Typedef native const-pointer-to-value type.

Template Parameters
ttype of pointer

template expands to

t *const var


Example:

int a = 10;
int b = 11;
const_ptr_to_val<int> p = &a; // eq. to int const *b = &a;
*p = 12; // OK
// p = &b; // illegal. will generate compiler error

◆ fref

template<typename t >
using corelink::fref = t &&

Forwarding reference.

Template Parameters
tvalue type

Please refer to https://en.cppreference.com/w/cpp/language/reference

◆ in

template<typename t >
using corelink::in = clvref<t>

Wraps a type and declares a value as an in parameter, which is a clvref.

Template Parameters
tnative or secondary type

this is useful for parameters which should not be mutated when passed to a function

void foo(in<int> num)
{
// ... refer to num
}
foo(2);

◆ lvref

template<typename t >
using corelink::lvref = fref<t &>

L-value reference typedef. equivalent to type &var Example.

Template Parameters
tnative or secondary type
void foo(lvref<std::string> s)
{
// ...
}
...
std::string b = "Bye";
foo(b); // OK

◆ out

template<typename t >
using corelink::out = lvref<t>

Wraps a type and declares a value as an out parameter, which is a lvref.

Template Parameters
tnative or secondary type

this is useful for parameters which should be mutated when passed to a function

void foo(out<int> num)
{
// ... change num and that will be propagated to a
}
int a = 2;
foo(a);

◆ ptr

template<typename t >
using corelink::ptr = t *

Typedef native pointer type.

Template Parameters
ttype of pointer

template expands to

t *var


Example:

int a = 10;
ptr<int> b = &a;

◆ ptr_to_const_val

template<typename t >
using corelink::ptr_to_const_val = t const *

Typedef native pointer-to-const-value type.

Template Parameters
ttype of pointer

template expands to

const t *var


Example:

int a = 10;
int b = 11;
ptr_to_const_val<int> p = &a; // eq. to int const *b = &a;
// *p = 12; // illegal. will generate compiler error
p = &b; // OK.

◆ rvref

template<typename t >
using corelink::rvref = fref<t &&>

R-value reference typedef Example.

Template Parameters
tnative or secondary type
void foo(rvref<std::string> s)
{
// ...
}
...
foo("Hello"); //OK
std::string b = "Bye";
foo(std::move(b)); // OK