|
Boost Users : |
From: whastingsnj (Hastings5_at_[hidden])
Date: 2002-05-07 21:06:36
The following works as desired in CBuilder C++ 6.0:
As you have discovered, Borland has a hard time with compile-time
constants used in template parameters.
#include <typeinfo>
#include <iostream>
#include "boost/config.hpp"
template <class T>
struct traita { BOOST_STATIC_CONSTANT(int, value=0); };
template <>
struct traita<int> { BOOST_STATIC_CONSTANT(int, value=1); };
template <class T, int>
struct trait1 {};
template <class T>
struct trait
{
BOOST_STATIC_CONSTANT(int, value=traita<T>::value);
typedef trait1<T, (traita<T>::value)> t1;
};
int main(int argc, char* argv[])
{
std::cout
<< typeid(trait<int>::t1).name()
<< std::endl
<< trait<int>::value
<< std::endl
;
return 0;
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net