Giter Site home page Giter Site logo

clsc's Introduction

CLSC (Cute Little Software Capital)

Coverity Scan Build Status Build Status

About

This is a toy-project dedicated to creating useful utilities that relatively modern C++ (C++17) misses. There is also an on-going work on quite interesting features not currently available in master.

Fast start

git clone https://github.com/andrey-golubev/clsc.git --recursive
cd clsc
python3 script/test.py

Note: googletest is used as a git submodule. Thus, it is required to clone it in order to build and run repository tests.

clsc's People

Contributors

andrey-golubev avatar

Stargazers

 avatar

clsc's Issues

Compile-time all_of, none_of, any_of

Add those just for fun. Draft implementation of one (but requires C++17 - can it be done in C++14?):

#include <type_traits>

template <template <typename, typename> class BinaryPredicate, typename... Ts>
struct all_of {
    static constexpr bool value = (BinaryPredicate<float, Ts>::value && ...);
};

template <template <typename, typename> class BinaryPredicate, typename T>
struct all_of<BinaryPredicate, T> {
    static constexpr bool value = BinaryPredicate<float, T>::value;
};

int main() {
    static_assert(all_of<std::is_same, float>::value, "Failed");
    static_assert(all_of<std::is_same, float, float>::value, "Failed");
    static_assert(!all_of<std::is_same, float, float, float, int>::value, "Failed");
    static_assert(!all_of<std::is_same, float, double, int>::value, "Failed");
    return 0;
}

Improve MAKE_ENUM utility

  • Support complex cases with user-defined values for some/each enum value
  • Use enum class
  • Change VAARGS_LEN to template version
  • Improve API

Prototype constexpr associative container

When having an array of certain items (e.g. callables), sometimes one wants to be able to seamlessly access a specific item. In a usual setup, array implies indices (integer values) which are not super convenient to use "as is".

Having a facade that translates user-specified item identifier (namely, a string) into an index of an array and then accesses the array element by an index, would significantly simplify life in certain cases.

It feels that the most natural usage for such idea is when a programmer actually has to write code by himself (not auto-called by some routine), thus, having a constexpr associative container (string -> int, 1-to-1 mapping) is a good enough option to go with.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.