Project information
Name: wheels
Main developer: R. Martinho Fernandes
Various C++ utilities
Latest version: 0.2.0
Released at: 09 Jun 2012 09:50
Project website: https://bitbucket.org/martinhofernandes/wheels
(last updated: 11 Jun 2012 00:47)

Wheels is just a library where I collect stuff I think I can reuse.

What's in there so far:

  • Template aliases for the standard type traits
    • wheels::RemoveReference<T> instead of typename std::remove_reference<T>::type. Several more interesting traits.
  • Operators for scoped enums
    • Scoped enums cannot be OR'ed or AND'ed together for example. That makes it difficult to make enums for flags. enums.h++ provides the bitwise operators for all enums for which the wheels::is_flags trait returns true (you can write your specializations) and arithmetic operators for all enums for which the wheels::is_arithmetic trait returns true (can also be explicitly specialized). No strong typing is lost.
  • make_unique
    • This one is a classic. The standard library has a std::make_shared function, but it lacks a std::make_unique. Using wheels::make_unique hides the new expression and that gives better exception safety. It supports named parameters for specifying a deleter. See tests for usage. There is also a similar wheels::make_shared with named parameters, and an wheels::allocate_unique.
  • Chrono stuffs
    • user-defined literals for time: 12_s is an instance of std::chrono::seconds with count() == 12.
    • Easy conversions to integral values in other units: wheels::to_minutes, wheels::to_seconds, etc.
    • stopwatches for timing code
  • Locker box
    • A wrapper that enforces the usage of a lock for access. Can be used by abusing range-based for.
  • Polymorphic copy smart pointer
    • wheels::value_ptr is a smart pointer that always copies the pointee. It can handle polymorphic classes without slicing and allows custom cloners and deleters. Just like std::shared_ptr and std::unique_ptr, factory functions are provided: wheels::make_value.
  • C++11 concepts for Boost.ConceptCheck
    • Currently not working in clang :(
  • Overloaded function object
    • For when you need a function object that combines several others (like, for example, when using boost::apply_visitor)
  • Optimal layout tuple
    • Just like std::tuple, but members are laid out in order to minimize padding. The interface is just like std::tuple, completely agnostic of the layout.
  • Other minor stuffs:
    • std::string user-defined literals
    • Expansion of a variadic parameter pack in an expression purely for side-effects
    • Optionally lazy invocation helper
    • Scope guard

See tests for examples of usage. Docs may be coming soon. Or late.

Bugs: Probably infinite.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License