For some reason I found myself attempting to implement the fixed-point combinator using C++ templates. Knowing how C++ templates are abused, that probably already exists...
This has been tested and compiled under Visual Studio 2010. Are there any serious problems with this implementation?
PS. This implementation is fully lambda expression based. If I can make fixpoint::fix a real member function it will be simpler than this.
//As decltype(variable)::member_name is...
The motivation I had for this isn't even a good one
template<class T>
class foo : public T {};
foo<foo> // Wait, you can't do that...
template<class T>
struct y {
using type = T<y<T>::type>;
};
y<foo>::type // infinite recursion much?
To be clear, that first class declaration is legal C++
Oh! I figured it out! When I reordered my cases, it reduced one function from a long switch statement to arg ^ 1 and another to arg & 2 ? arg : arg ^ 4.
@lyxal I wouldn't have minded that because it's a topic I find interesting, but if someone had suggested moving it to a different room I would 100% have agreed