|
Boost : |
From: Hamish Mackenzie (boost_at_[hidden])
Date: 2001-11-27 09:56:35
On Tue, 2001-11-27 at 14:11, Emily Winch wrote:
> So long as we put in an assert that head_value and Tail::head_value are the
> same type. Otherwise people could make really counterintuitive types by
> putting
I think you mean head_type.
In fact if it should realy be value_type if the list is not going to be
heterogenous (which was what I was thinking).
template< class Type, Type value, class Tail >
class static_const_value_list
{
public:
BOOST_STATIC_ASSERT(
is_same< Type, typename Tail::value_type >::value )
static const Type head_value = Value;
typedef Type value_type;
typedef Tail tail_type;
class nil
{
typedef Type value_type;
};
};
> Unless we _wanted_ a heterogenous compile time value list. Is there a use
> for that?
Yes, how about a compile time sprintf function.
Of course we would need a good compile time string system to be able to
use it easily.
If ctstring( "abc" ) expanded to recusive< char_list, 'a', 'b', 'c' >
that would do it.
Then you would define
template< class FormatString, class Args >
class compile_time_sprintf
{
public:
typedef ???? result;
};
Result would be another char_list with the formated numbers in it.
Hamish
>
> Emily
>
> Info: http://www.boost.org Unsubscribe: <mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk