/* クラス array<> の使用例
*/
#include <string>
#include <iostream>
#include <boost/array.hpp>
template <class T>
void print_elements (const T& x);
int main()
{
// 四季の array を作る
boost::array<std::string,4> seasons = {
{ "spring", "summer", "autumn", "winter" }
};
// コピーして、並び順を変える
boost::array<std::string,4> seasons_orig = seasons;
for (unsigned i=seasons.size()-1; i>0; --i) {
swap(seasons.at(i),seasons.at((i+1)%seasons.size()));
}
std::cout << "one way: ";
print_elements(seasons);
// swap() を試す
std::cout << "other way: ";
swap(seasons,seasons_orig);
print_elements(seasons);
// 逆イテレータを使ってみる
std::cout << "reverse: ";
for (boost::array<std::string,4>::reverse_iterator pos
=seasons.rbegin(); pos<seasons.rend(); ++pos) {
std::cout << " " << *pos;
}
std::cout << std::endl;
return 0; // Visual-C++ コンパイラのご機嫌をとる
}
template <class T>
void print_elements (const T& x)
{
for (unsigned i=0; i<x.size(); ++i) {
std::cout << " " << x[i];
}
std::cout << std::endl;
}
- コミュニティ
- Boostライブラリのビルド方法
- メーリングリスト
- 運営メンバ
- Boostを使用しているプロジェクト
-
アーカイブ
-
旧Boost日本語化プロジェクト
-
document
-
各ライブラリの翻訳ドキュメント
- Boost.Compatibilty ライブラリ
- mem_fn.hpp
- §ヘッダファイル(Header) <[boost/static_assert.hpp](http://www.boost.org/doc/libs/1_31_0/boost/static_assert.hpp)>
- Header <[boost/type_traits.hpp](http://www.boost.org/doc/libs/1_31_0/boost/type_traits.hpp)>
- Array wrapper library
-
bind.hpp
-
非推奨: Compose library
-
The Boost Concept Check Library (BCCL)
-
Boost Conversion Library
-
Boost Date-Time Library Documentation
-
Disjoint Sets(互いに素な集合)
-
Boost Format library
-
Header `<boost/function.hpp>`
-
Improved Function Object Adapters
-
the Boost Graph Library
-
io
-
The Boost Lambda Library
-
Boost Math Library
-
Boost.MultiArray
-
Boost Pool Library
-
Boost Preprocessor Library
-
Boost Random Number Library
-
Rational Number Library
-
regex++, Index
-
Boost.Signals
-
Smart Pointer Library
-
The Boost Tuple Library
-
utility
-
document
-
C++オンライン読書会
-
提案予定プロジェクト
-
旧Boost日本語化プロジェクト
-
BoostCon
-
C++Now!
-
ドキュメント
-
editors_doc
-
Boost.勉強会
-
Boost逆引きリファレンス