【C++】STL(Standard Template Library)相談室 8at TECH
【C++】STL(Standard Template Library)相談室 8 - 暇つぶし2ch178:デフォルトの名無しさん
08/01/17 18:09:45
>>176

#include <utility>
#include <algorithm>
#include <iostream>
#include <iterator>

template <class T, int n>
std::pair<T*, T*> iseq(T (&a)[n])
{
 return std::pair<T*, T*>(a, a + n);
}

int main()
{
 int x[] = {6, 1, 3, 4, 2};
 std::sort(iseq(x).first, iseq(x).second);
 std::copy(x, x + sizeof(x) / sizeof(x[0]), std::ostream_iterator<int>(std::cout, " "));
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch