Skip to content

Instantly share code, notes, and snippets.

@loliGothicK
Last active March 25, 2018 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loliGothicK/0e2586c9693d989e00d216fdab1c8287 to your computer and use it in GitHub Desktop.
Save loliGothicK/0e2586c9693d989e00d216fdab1c8287 to your computer and use it in GitHub Desktop.
#include <type_traits>
#include <utility>
#include <iterator>
template < class Range >
func(Range&& range)
-> std::enable_if<decltype(std::begin(std::declval<typename std::decay<Range>::type>()) + 2, std::true_type{})>
{
// Rangeはランダムラクセスイテレータを持つコンテナなので
// ランダムラクセスするアルゴリズムを記述できる
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment