當(dāng)前位置:
首頁(yè) >
boost learn notes
發(fā)布時(shí)間:2025/7/25
37
豆豆
生活随笔
收集整理的這篇文章主要介紹了
boost learn notes
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
<?xml version="1.0" encoding="utf-8"?> boost learn notes
boost learn notes
Documents
http://www.boost.org/doc/libs/1\_53\_0/libs/libraries.htm
Get Started
example.cpp
#include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm>int main() {using namespace boost::lambda;typedef std::istream_iterator<int> in;std::for_each(in(std::cin), in(), std::cout << (_1 * 3) << " " ); }Build it
cl /EHsc /I <path-to-boost> example.cpp
Run initcl if cl is not available.
Run it
echo 1 2 3 | example
Further reading material
http://stlchina.huhoo.net/bin/view.pl/Main/WebSearch?search=BoostSource&scope=all&web=Main
boost::any
以單個(gè)對(duì)象接受所有型別的數(shù)據(jù),以any_cast取出數(shù)據(jù)。
template<typename ValueType> ValueType * any_cast(any * operand) {return operand && operand->type() == typeid(ValueType) ? &static_cast<any::holder<ValueType> *>(operand->content)->held:0; }boost::type_traits
type traits的動(dòng)機(jī)是分派,已實(shí)現(xiàn)函數(shù)重載。
is_array的簡(jiǎn)化版
template<bool b_> struct bool_type{ static const bool value = b_; }; template<bool b_> const bool bool_type<b_>::value; template<typename T> struct is_array : bool_type<false>{ }; template<typename T> struct is_array<T[]>: bool_type<true>{ }; template<typename T, unsigned int N> struct is_array<T[N]> : bool_type<true>{ }; int main() { bool is_1 = is_array<int[]>::value; bool is_2 = is_array<int[5]>::value; bool is_3 = is_array<int>::value; }Post by: Jalen Wang (轉(zhuǎn)載請(qǐng)注明出處)
轉(zhuǎn)載于:https://www.cnblogs.com/jalenwang/archive/2013/05/07/3064233.html
總結(jié)
以上是生活随笔為你收集整理的boost learn notes的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: C# winform 捕获全局异常
- 下一篇: 用py2exe打包后的程序一闪而过