Monday, March 31, 2008

Template static member brace-enclosed initializer

Or something...

#include <iostream>

using namespace std;

template<class _prec=double>
class myclass {
static const string mystuff[];

_prec avalue;

template<class _prec>
const string myclass<_prec>::mystuff[] = {"Athing", "Another","Things"};

int main() {

myclass<> m;

cout << m.mystuff[0] << endl;


nobodycares said...

wtf does that end up printing.

new said...

Athing, for some reason I had trouble getting this working not sure why looking at it there's nothing weird but I wanted to log it somewhere...