Created
August 5, 2014 14:49
-
-
Save Fuyutsubaki/5294ff1fc031e4fe323b to your computer and use it in GitHub Desktop.
TMP二分木fold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace otmp | |
{ | |
template<class list, template<class...>class Func> | |
class fold1 | |
{ | |
template<std::size_t Begin, std::size_t Len> | |
struct impl | |
:Func<typename impl<Begin, Len / 2>::type, typename impl<Begin + Len / 2, Len - Len / 2>::type> | |
{}; | |
template<std::size_t Begin> | |
struct impl<Begin, 1> | |
:at<Begin, list> | |
{}; | |
public: | |
using type = typename impl<0, getLength_t<list>::value>::type ; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment