GitHub - agruzdev/Yato: Cross-platform STL-styled and STL-compatible library with implementing containers, ranges, iterators, type traits and other tools; actors system; type-safe config interface. (original) (raw)

Yato

A small repository where I'm gatherting useful snippets and abstractions for C++ development.

Yato includes 3 main modules: multidimensional containers and utils, actors system, and type-safe config.

If you find any bug, please feel free to submit an issue! It will be very helpful for me.

Licence

Copyright 2016-2022 Alexey Gruzdev

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Build/Install

The library consists of only headers, so it doesn't require build. The repository provides sources for some tests sources that can be configured and built with the help of cmake file. In order to build the tests you will need to add directory of googletest to the cmake (GoogleTest repository)

The library targets only modern compiler versions. Most recently checked compilers:

Description

Actors system

Yato provides a simple actors system implementation, that is developed to look and feel like Akka. It supports basic features of an actor system and optional io model for networking.

More...

Type support

Yato library provides a set of additional type traits

Also there are additional tools for working with types. The library provides literals for fixed size types (_u8, _u16, etc.) if user defined literals are supported by compiler. Additional casts are provided:

Functional traits

Type matching

yato::match performs compile time matching of variable type based on function overloading mechinism

"Annotations"

There are a couple of experiments inspired by Cpp Core Guidelines

Ranges

yato::range - aggregator of a couple of iterators simplifing passing two iterators to functions, returning iteratos from functions, hepling to hold iterators of one container together. Can be ued in ranged for expressions. Together with yato::numeric_iterator the range can represent a sequence of integer numbers without actual storing them

Range provides the following functional style operations:

Containers

Yato implemets a number of general purpose containers:

Reflection

WIP

Current implementation allows to reflect classes and data fields Reflection information allows to get a list of data fields and its types in compile time, iterate over all data fields and get pointers to fields in run-time

Tuple algorighms

Yato library provides few compile time algorithms on tuples

Iterators

Allocator

Type safe wrappers

Cast between variants with different sets of alternatives can be made with the help of yato::variant_cast.

There provided effective matchers for yato::any and yato::variant allowing to handle stored value in swicth style. If no match is found then default case is called (yato::match_default_t) if defined, otherwise the exception yato::bad_match_error is thrown.

Attributes interface

yato::attributes_interface is interface class allowing to add arbitrary attributes to a class instance (as key-value pair). Attributes are completely generic and are passed as yato::any. Only the concrete implementation is able to take or discard passed attribute. Is useful for passing parameters to very different types in one hierarchy so that base classes don't know about parameters types.

There are few generic implementations

Extras

Acknowledgments

Yato is used by HUAWEI Noah's Ark Lab

logo