* [[http://quantlib.org/slides/dima-boost-intro.pdf|A Short Introduction to Selected Classes of the Boost C++ Library]]
====== 安裝 Boost ======
# ./bootstrap.sh
編輯 project-config.jam 做細部設定。例如指定使用非系統預設的編譯器:
using gcc : : /full/path/to/g++ ;
# ./bjam
===== Windows =====
* [[http://boost.teeks99.com/|Boost Pre-Built Binaries]]
* [[http://sourceforge.net/projects/boost/|Boost C++ Libraries]]
* [[http://stackoverflow.com/questions/2715164/how-can-i-decode-the-boost-library-naming|How can I decode the boost library naming?]]
* libboost_graph-vc90-mt-s-1_47.lib
* libboost_graph-vc90-mt-sgd-1_47.lib
* [[http://stackoverflow.com/questions/2629421/how-to-use-boost-in-visual-studio-2010|How to use Boost in Visual Studio 2010]]
* [[https://www.youtube.com/watch?v=5AmwIwedTCM|Compiling and configuring Boost C++ libraries for Visual Studio 2010]]
====== Boost 使用範例 ======
FreeBSD 請到 ''/usr/local/share/doc/boost/libs'' 查看範例檔。
====== Boost.Lambda ======
Lambda 簡介。[(http://www.cs.bham.ac.uk/~axj/pub/papers/lambda-calculus.pdf)]
[[http://herbsutter.com/2010/10/30/pdc-languages-panel-andshortened-lambdas-talk/|PDC Languages Panel and (Shortened) Lambdas Talk]]
====== Boost.Iostreams ======
====== Boost.uBLAS ======
* [[http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Effective_UBLAS|Effective uBLAS]]
* [[http://www.guwi17.de/ublas/index.html|Some tricks to use boost/ublas]]
====== Boost.Thread ======
* [[http://thread.gmane.org/gmane.comp.lib.boost.user/55299|mix usage of boost.thread and pthread?]]
* [[http://leven.co/blog/view/19|在C++中使用pthread]]
* [[http://blog.emptycrate.com/node/270|Multithreaded C++: Part 1: Pthreads]]
===== Boost.MPI =====
系統要先安裝 MPI 函式庫才能安裝 Boost.MPI。。
目前 FreeBSD ports 中的 devel/boost-libs/Makefile 不會安裝 Boost.MPI。
#include
#include
#include
namespace mpi = boost::mpi;
int main(int argc, char* argv[])
{
mpi::environment env(argc, argv);
mpi::communicator world;
std::cout << "I am process " << world.rank() << " of " << world.size()
<< "." << std::endl;
return 0;
}
# g++45 -I/usr/local/include/ -L/usr/local/lib/ mpi.cpp -lboost_mpi -lboost_serialization
# mpd&
# mpiexec -n 2 ./a.out
===== Boost.Graph =====
Boost.Graph 的使用請參考 [[http://www.cppprog.com/2009/0408/100.html|[译]使用Boost Graph library]] 和[[http://blog.chinaunix.net/u2/62093/showart_484485.html|Boost Graph Library 快速入门]]。
===== Boost.Program_options =====
===== Boost.Iostreams =====
===== Boost.Signals =====
Boost.Signals 和 Linux 中的 signal 並不相干。Boost.Signals 是用來實現 [[wp>observer pattern]] 或是 [[wp>Publish/subscribe|publisher-subscriber mechanism]]。
===== Boost.Test =====
Boost.Test 的使用可參考 [[http://www.boostcon.com/site-media/var/sphene/sphwiki/attachment/2007/05/28/Boost_Test_Library_Tutorial.pdf|Boost Test Library Tutorial]]
#define BOOST_AUTO_TEST_MAIN
#include
int add(int i, int j)
{
return i + j;
}
BOOST_AUTO_TEST_SUITE(minimal_test)
BOOST_AUTO_TEST_CASE(my_test)
{
BOOST_CHECK(add(2, 2) == 5);
BOOST_REQUIRE(add(2, 2) == 4);
if(add(2, 2) != 4)
BOOST_ERROR("oops!");
if(add(2, 2) != 4)
BOOST_FAIL("oops!");
if(add(2, 2) != 4)
throw "oops!";
BOOST_CHECK_MESSAGE(add(2, 2) == 4, "add(..) result: " << add(2, 2));
BOOST_CHECK_EQUAL(add(2, 2), 4);
}
BOOST_AUTO_TEST_SUITE_END()
g++ -I /usr/local/include/ test.cpp -lboost_test_exec_monitor
===== Boost.Python =====
#include
#include
#include
using namespace boost::python;
int main()
{
Py_Initialize();
object main_ns = import("__main__").attr("__dict__");
std::string str = "for x in range(1,5):\n"
"\tprint x";
exec(str.c_str(), main_ns);
}
g++ -I /usr/local/include/python2.6/ py.cpp -lpython2.6 -lboost_python
#include
#include
std::string greet() { return "hello, world"; }
#include
using namespace boost::python;
BOOST_PYTHON_MODULE(hello) {
def("greet", greet);
}
g++ -fPIC -I/usr/local/include/python2.6 -I/usr/local/include/ -c hello.cpp -o hello.o
g++ -fPIC -shared -Wl,--export-dynamic -L/usr/lib hello.o -lpython2.6 -lboost_python -o hello.so
import hello
print hello.greet();
help(hello)
====== 參考書籍 ======
* [[http://www.waterlike.com.tw/bookdata.asp?NO=TP3C10A081|Boost程序庫完全開發指南‧深入C++“準”標準庫]]
====== 外部連結 ======
* [[http://www.boost.org/|Boost C++ Libraries]]
* [[http://www.boostcon.com/home|BoostCon]]
* [[http://www.boost.org/doc/libs/1_35_0/tools/index.html|Boost Tools]]
* [[http://www.cppprog.com/boost_doc/|中文版Boost文档]]
* [[http://daveabrahams.com/2010/09/03/whats-so-cool-about-boost-mpi/#fnref:buffers|What’s so cool about Boost.MPI?]]
* [[http://www.shocksolution.com/math_tools/boost.python/index.html|Boost.Python Examples and Tutorials]]
* [[http://www.justsoftwaresolutions.co.uk/|Just Software Solutions ]]
* [[http://en.highscore.de/cpp/boost/|The Boost C++ Libraries]]
* [[http://www.bnikolic.co.uk/blog/·Computing Blog -- Complete Index and permanent links]]
~~REFNOTES~~