Skip to content

A C++11 library to operate on std::tuples, inspired by Boost.Fusion and Boost.MPL

License

Notifications You must be signed in to change notification settings

eggs-cpp/tupleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Eggs.Tupleware

Introduction

Eggs.Tupleware is a C++11 library to operate on std::tuples, inspired by Boost.Fusion and Boost.MPL. Unlike those libraries, there is no concept of Sequence but only that of Tuple-like type. A Tuple-like type is one that fulfills the tuple-like protocol, examples of such types other than std::tuple<...> are std::pair<T, U> and std::array<N, T>.

Design decisions

The library is implemented making extensive use of C++11 features, and in a way which is transparent to features like constexpr and noexcept where possible.

All functionality is provided within the eggs::tupleware namespace. For each provided function f, the following is also provided:

  • result_of::f<Args...>, with a member typedef type equivalent to the expression INVOKE(f(std::declval<Args>()...)) when such expression is well-formed, otherwise there is no member type.

  • functional::f, a function object that forwards to f when the call expression is well-formed.

  • meta::f, a metaprogramming equivalent of f, only provided when the functionality has no side-effects.

Calls to the base functionality f will detect requirement violations (when the resulting error is a soft-error), and report them via static_asserts —which provides clear information on what's wrong but none as to why; more experimenting is needed in order to include the actual compiler error with reduced noise if possible—.

In order to propagate constexpr and noexcept, the underlying standard library implementation has to provide those guarantees for a few key functions —get, move, forward, ...—, which is only required by the C++14 standard. Compile-time performance will be greatly improved if the implementation of std::tuple<...> is non-recursive —as the one shipped with libc++—.


Copyright Agustín Bergé, Fusion Fenix 2014

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

About

A C++11 library to operate on std::tuples, inspired by Boost.Fusion and Boost.MPL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages