cppx-core
Namespaces | Typedefs | Functions
type-assemblers.hpp File Reference

Simple type builders Type_, P_, R_, Raw_array_ and Raw_array_of_. More...

#include <cppx-core/language/syntax/macro-use.hpp>
#include <c/stddef.hpp>
Include dependency graph for type-assemblers.hpp:

Go to the source code of this file.

Namespaces

 cppx
 
 cppx::type_assemblers
 Type_, P_, R_, Raw_array_, Raw_array_of_
 
 cppx::ptr_and_ref
 Self-descriptive but more wordy Ptr_ and Ref_ aliases for P_ and R_.
 

Typedefs

template<class Some_type >
using cppx::Type_ = Some_type
 Makes a C style type specification substitutable. More...
 
template<class Some_type >
using cppx::P_ = Some_type *
 Creates a raw pointer type. More...
 
template<class Some_type >
using cppx::R_ = Some_type &
 Included for completeness, creates an lvalue reference type. More...
 
template<class Item >
using cppx::Raw_array_ = Item[]
 Ceates a raw array type of unknown size. More...
 
template<size_t n, class Item >
using cppx::Raw_array_of_ = Item[n]
 Creates a raw array type of a specified size. More...
 
template<class T >
using cppx::ptr_and_ref::Ptr_ = P_< T >
 
template<class T >
using cppx::ptr_and_ref::Ref_ = R_< T >
 

Functions

 cppx::type_assemblers::CPPX_USE_CPPX (Type_, P_, R_, Raw_array_, Raw_array_of_)
 

Detailed Description

Simple type builders Type_, P_, R_, Raw_array_ and Raw_array_of_.

The more safe standard library generators such as std::add_pointer_t are not used because they would prevent template argument deduction. The basic builders defined here are just names for the conventional way of writing e.g. formal argument types, i.e. they're simple assemblers. As such they carry the same risk of unintended type result as the raw operator notation does, but they have advantages such as supporting uniform const first notation, more generally read-left-to-right declarations, and being self-descriptive.

Definition in file type-assemblers.hpp.