본문 바로가기

Dev/C++

boost 를 이용한 TR1 Library 사용하기

출처 : http://boost.org/doc/html/boost_tr1/usage.html

boost 1.34 버전 이상 부터 지원

std::tr1 내용 :

Reference Wrappers.
Smart Pointers.
Class template result_of.
Function template mem_fn.
Function Object Binders.
Polymorphic function wrappers.
Type Traits.
Random Number Generators and Distributions.
Tuples.
Tuple Interface to std::pair.
Fixed Size Array.
Hash Function Objects.
Regular Expressions.
Complex Number Algorithm Overloads.
Complex Number Additional Algorithms.




Header Include Style

There are two ways you can include the Boost.TR1 headers, for example if you are interested in shared_ptr then you can either use:

#include <boost/tr1/memory.hpp>

or:

#include <memory>

The first option is the preferred method for other Boost libraries to use. The second option is standard-conforming, but requires that you add boost-install-path/boost/tr1/tr1 to your compiler's include search path. Note that you must not copy the headers in boost/tr1/tr1 into a directory called "include", doing so will cause them to cease working.


Important Note #1


The include path order is very important if you want this library to work correctly. If you get compiler errors then suspect the include paths. The correct order is:

1) boost-root/boost/tr1/tr1
2) boost-root
3) Any other standard library replacements (STLport for example).
4) Your regular standard library.

Important Note #2: Borland C++ Users


Borland's compiler has a particularly broken form of #include, that will actually look for a file named array.h if you #include <array>. In order to make this library work with Borland's compiler you will need to set up the include paths as follows:

1) boost-root/boost/tr1/tr1/bcc32
2) boost-root/boost/tr1/tr1
3) boost-root
4) Any other standard library replacements (STLport for example).
5) Your regular standard library.

Important Note #3: Sun C++ Users

Sun's compiler has a particularly interesting form of #include, that will actually look for a file named array.SUNWCCh if you #include <array>. In order to make this library work with Sun's compiler you will need to set up the include paths as follows:

1) boost-root/boost/tr1/tr1/sun
2) boost-root/boost/tr1/tr1
3) boost-root
4) Any other standard library replacements (STLport for example).
5) Your regular standard library.

'Dev > C++' 카테고리의 다른 글

main function  (0) 2008.05.01
tr1::regex (boost::regex) 샘플코드  (0) 2007.10.21
boost 를 이용한 TR1 Library 사용하기  (0) 2007.10.10
VC++ 2005 배포  (0) 2007.06.22
Unhandled C++ Exceptions  (0) 2007.06.19
OutputDebugString  (0) 2007.05.23

태그