Skip to content

dechimal/desalt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Desalt - C++1z Utility Libraries

Desalt ease using some metaprogramming idiom on C++1z.

Library includes following features:

- AutoFun : Deduce return type of a function by the expression of return statement.
- Require : Conditional overloaded function selection using SFINAE.
- ParameterPack : Assist metaprogramming with parameter pack.
- Newtype : Make a different type with existing type easily (inspired by Haskell's newtype),
- StaticControl : sfinae-based compile-time branch and loop (static if, static for, etc...).
- Format : A extensible printf.

The samples are under test/ directory.


AutoFun

  Header
  desalt/auto_fun.hpp

  Synopsis
  #define DESALT_AUTO_FUN(name_sig, expr) /* unspecified */
  #define DESALT_AUTO_FUN_NOEXCEPT(name_sig, expr) /* unspecified */

  DESALT_AUTO_FUN define a function what has a name and a signature by name_sig.
  The return type is decltype(expr).

  Parameters
  name_sig | A name and signature of function.
           | grammer is:
           |   name_sig:
           |     declarator-id ( parameter-declaration-clause )
           |       cv-qualifier_opt ref-qualifier_opt exception-specification_opt
  expr     | A expression to be body of the function and to determine the return type.
           | expr can include some number comma.
 
  Semantics
  A declaration
    DESALT_AUTO_FUN( name_sig , expr ) ;
  generates following function definition:
    auto name_sig -> decltype( expr )
      { return expr ; }
  cv-qualifier, ref-qualifier, and exception-specification are optional.

  DESALT_AUTO_FUN_NOEXCEPT(name_sig, expr) is same DESALT_AUTO_FUN(name_sig, expr) except exception-specification is determined by noexcept(expression).

  Example
  See test/auto_fun.cpp

Require

  Header
  desalt/require.hpp

  Synopsis
  #define DESALT_REQUIRE(mpl_cond) /* unspecified */
  #define DESALT_REQUIRE_NOT(mpl_cond) /* unspecified */
  #define DESALT_REQUIRE_C(cond) /* unspecified */
  #define DESALT_REQUIRE_EXPR(expr) /* unspecified */

  Parameters
  mpl_cond | A model of Boost.MPL Integral Constant.
  cond     | A integral-constant-expression.

  Semantics


ParameterPack

  Header
  desalt/parameter_pack.hpp

Newtype

  Header
  desalt/newtype.hpp

StaticControl

  Headers
  desalt/static_control.hpp
  desalt/static_control/static_control.hpp
  desalt/static_control/static_if.hpp
  desalt/static_control/static_match.hpp
  desalt/static_control/static_while.hpp
  desalt/static_control/static_for.hpp
  desalt/static_control/with_unpacked.hpp
  desalt/static_control/with_index_sequence.hpp
  desalt/static_control/wrap.hpp
  desalt/static_control/clause.hpp

Format

  Header
  desalt/format.hpp

About

A metaprgramming utilities for C++1z.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published