【C++】STL(Standard ..
[2ch|▼Menu]
178:デフォルトの名無しさん
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, " "));
}


次ページ
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

4813日前に更新/208 KB
担当:undef