Library: search for a way to rebind to nested definitions

...automatically whenever those are present.
Up to now, we hat that as base case, which limited usage to those cases
where we already know such nested definitions are actually present
This commit is contained in:
Fischlurch 2017-11-30 22:27:24 +01:00
parent d73b0b05b2
commit 6bb288bf20
2 changed files with 11 additions and 1 deletions

View file

@ -40,6 +40,8 @@
#include "lib/error.hpp" #include "lib/error.hpp"
#include "lib/meta/duck-detector.hpp" ////////TODO
#include "lib/meta/util.hpp" ////////TODO
@ -51,6 +53,8 @@ namespace std {
namespace lib { namespace lib {
namespace meta { namespace meta {
META_DETECT_NESTED (value_type);
/** /**
* Type re-binding helper template for creating nested typedefs * Type re-binding helper template for creating nested typedefs
* for use by IterAdapter or similar "Lumiera Forward Iterators". * for use by IterAdapter or similar "Lumiera Forward Iterators".
@ -104,7 +108,7 @@ namespace meta {
* STL style type binding definitions themselves * STL style type binding definitions themselves
*/ */
template<typename TY> template<typename TY>
struct TypeBinding<TY, typename TY::value_type *> struct TypeBinding<TY, enable_if<HasNested_value_type<TY>> >
{ {
typedef typename TY::pointer pointer; typedef typename TY::pointer pointer;
typedef typename TY::reference reference; typedef typename TY::reference reference;

View file

@ -200,6 +200,12 @@ namespace test{
cout << showType<TypeBinding<Join&>::reference>() <<endl; cout << showType<TypeBinding<Join&>::reference>() <<endl;
cout << showType<TypeBinding<Join&>::pointer>() <<endl; cout << showType<TypeBinding<Join&>::pointer>() <<endl;
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #888
cout << showType<TypeBinding<Join&&>::value_type>() <<endl;
cout << showType<TypeBinding<Join&&>::reference>() <<endl;
cout << showType<TypeBinding<Join&&>::pointer>() <<endl;
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #888
cout << showType<TypeBinding<Join const&>::value_type>() <<endl; cout << showType<TypeBinding<Join const&>::value_type>() <<endl;
cout << showType<TypeBinding<Join const&>::reference>() <<endl; cout << showType<TypeBinding<Join const&>::reference>() <<endl;
cout << showType<TypeBinding<Join const&>::pointer>() <<endl; cout << showType<TypeBinding<Join const&>::pointer>() <<endl;