Historically C++ declaration syntax has been a total mess. Spiral rule and operators reused to declare stuff can make declarations unreadable to the point that people create special demangling services. With the recent introduction of rvalue- and universal- references situation became even worse.
Straight Declarations is a header-only C++11 library providing alias templates to declare arrays, pointers and references with uniform syntax and clear semantics. This library makes it possible to write declarations with left-to-right reading order and eliminates reuse of *, &, [ and ] symbols. This library does not aim to eliminate intermediate type aliases or make declarations shorter (though it may happen in certain cases).
Downloads for rev. 83
hg clone https://bitbucket.org/guaranteed-to-be-unique/straight-declarations
git clone https://github.com/guaranteed-to-be-unique/straight-declarations.git
Compiler with decent C++11 support. Tested compilers:
- Visual C++: 14.0, 14.1
- g++: 4.8.2, 4.9.4, 5.4.1, 6.3.0
- clang++: 3.5.0, 3.9.1, 4.0.1
- Building projects using VS emits warning "MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build.". This warning is caused by use of $(TEMP) as Intermediate directory. None of the projects use incremental building so this warning can be safely ignored.
- Building Test project emits quite a lot of warnings from the depths of Boost.Test implementation. Though most of them are rather harmless boost developers really need to get their shit together.
- VS successfully compiles test Array_Of_ZeroItemsCompilationFailure.
- VS emits errors (including ICE) when instantiating a template among parameters of which there is a function signature with another template instantiated as a trailing return type. For example:Heading return type can be used as a workaround.ptr<auto (void) ->ref<int>>p_fun;