4 #ifndef __SFJP_ROAST__lexical2__length_HPP__
5 #define __SFJP_ROAST__lexical2__length_HPP__
7 #include "roast/type_traits/is_derived.hpp"
13 //////////////////////////////////////////////////////////////////
15 struct length_any {}; // for convertible check by length_of<T>.
17 template <unsigned int LENGTH>
18 struct length_ : length_any {
19 static const int length = LENGTH;
22 typedef length_<0> zero_length;
24 //////////////////////////////////
26 template <typename U, bool _Valid>
27 struct _length_of_impl
29 static const int value = U::length;
32 struct _length_of_impl<U, false>{};
35 struct length_of : public _length_of_impl<
36 T, type_traits::is_convertible<T,length_any>::value
39 //////////////////////////////////////////////////////////////////
43 #endif//__SFJP_ROAST__lexical2__length_HPP__