Tuesday, May 27, 2008

Leaking some Internal primes

I'm still just getting a feel for the C++ code implementing the algorithm described "Stochastic Graph Partition: Generalizing the Swendsen-Wang Method." (Author's post on LJ.) One thing I noticed right away though is that it depends on tr1! The readme mentioned it being compiled on a Mac using gcc 4.0.1, and I thought, "I have that! Do I already have TR1?!" A quick check with Spotlight revealed that it was indeed there. So, now here is some useless code depending on implementation details which shouldn't be used:
#include <algorithm>
#include <tr1/hashtable>
#include <iostream>
#include <iterator>

int main()
{
Internal::X<0> x;
std::copy(x.primes, x.primes + x.n_primes,
std::ostream_iterator<unsigned long>(std::cout, "\n"));
}

No comments: