All Projects → compmaniak → typed_flags

compmaniak / typed_flags

Licence: MIT license
Type-safe and human-readable set of bool flags

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to typed flags

hypertag
HTML templates with Python-like concise syntax, code reuse & modularity. The Pythonic way to web templating.
Stars: ✭ 27 (+17.39%)
Mutual labels:  templates
simplest view
SimplestView gives us the power to split Rails Views out from our Templates
Stars: ✭ 41 (+78.26%)
Mutual labels:  templates
semantic-ui-forest
[Archived] Source code for official semantic-ui-forest website.
Stars: ✭ 49 (+113.04%)
Mutual labels:  templates
global-typelist
How to build and maintain a "global" type-list
Stars: ✭ 22 (-4.35%)
Mutual labels:  templates
zsh-launchpad
🚀 Simple, educational dotfiles template to get started with Zsh and learn about its features
Stars: ✭ 141 (+513.04%)
Mutual labels:  templates
Azia-Admin-Bootstrap-Template
Free Bootstrap 4 Admin template
Stars: ✭ 73 (+217.39%)
Mutual labels:  templates
templates
Collection of Conan recipe + CI templates
Stars: ✭ 71 (+208.7%)
Mutual labels:  templates
manifest-design
vue开发的商品标签设计插件 && 系统,功能包含:设计,预览,打印
Stars: ✭ 133 (+478.26%)
Mutual labels:  templates
tsafe
🔩 The missing TypeScript utils
Stars: ✭ 285 (+1139.13%)
Mutual labels:  type-safety
readme-generator
Generate a readme from a template and package.json data. If you need something more comprehensive, I recommend using Verb.
Stars: ✭ 18 (-21.74%)
Mutual labels:  templates
django-apptemplates
Django template loader that allows you to load and override a template from a specific Django application.
Stars: ✭ 43 (+86.96%)
Mutual labels:  templates
pyLODE
An OWL ontology documentation tool using Python and templating, based on LODE
Stars: ✭ 116 (+404.35%)
Mutual labels:  templates
django-template
A battle-tested Django 2.1 project template with configurations for AWS, Heroku, App Engine, and Docker.
Stars: ✭ 64 (+178.26%)
Mutual labels:  templates
flutter getx template
🍻🍀 This is source base for getx flutter. Optimize by lambiengcode
Stars: ✭ 43 (+86.96%)
Mutual labels:  templates
gas-vue-typescript
Template for Google Apps Script macros and its front-end webapp setup with TypeScript, Vue.js, Vuetify.
Stars: ✭ 40 (+73.91%)
Mutual labels:  templates
ConvNet-OOP
ConvNet Implementation: An Object Oriented Approach using Keras API.
Stars: ✭ 20 (-13.04%)
Mutual labels:  templates
drupal-template-helper
Debug Drupal 8 templates in Chrome Devtools. drupal-template-helper is a chrome extension for Drupal that lists all available templates and the preprocess hooks to use to customize your templates.
Stars: ✭ 115 (+400%)
Mutual labels:  templates
cargo-scaffold
cargo scaffold lets you scaffold and generate projects described in a simple TOML file
Stars: ✭ 34 (+47.83%)
Mutual labels:  templates
SPX-GC
SPX is a graphics control client for live video productions and live streams using CasparCG, OBS, vMix, or similar software.
Stars: ✭ 178 (+673.91%)
Mutual labels:  templates
PolyCast
Safely cast values to int, float, or string in PHP
Stars: ✭ 52 (+126.09%)
Mutual labels:  type-safety

Typed flags

Build Status Build status Try online

Type-safe and human-readable sets of bool flags.

Quick start

Start by declaring some types

class eats_meat;
class eats_grass;
class has_tail;

Then bind these types to flag identifiers

typedef typed_flags<eats_meat, eats_grass, has_tail> animal;

Create flags from scratch

animal wolf;
wolf.set<eats_grass>(false);
wolf.set<eats_meat, has_tail>();
wolf.set(flag<has_tail>{1}, flag<eats_meat>{1});

Create flags with a flexible human-readable constructor

wolf = animal{flag<has_tail>{1}, flag<eats_meat>{1}, flag<eats_grass>{0}};

Test each flag separately

assert( (wolf.test<eats_meat>() && wolf.test<has_tail>()) );

Test a group of flags in one call

assert( (wolf.all<eats_meat, has_tail>()) );
assert( (wolf.any<eats_meat, has_tail, eats_grass>()) );
assert( (wolf.none<eats_grass>()) );

Extract flag values

flag<eats_meat> f1;
flag<has_tail> f2;
wolf.get(f1, f2);
assert( f1 && f2 );

Create flags from integers or strings and convert back and forth - like std::bitset

auto a1 = animal{3};
auto a2 = animal{"101"};
assert( a1.to_integral<int>() == 3 );
assert( a2.to_string() == "101" );

Documentation

You can find more detailed info here.

Requirements

To build tests and examples you need

  • cmake
  • compiler supporting fold-expressions from C++17 (GCC 6, Clang 3.8+)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].