C++之boost::array的用法
更新時(shí)間:2014年10月22日 10:37:54 投稿:shichen2014
這篇文章主要介紹了C++之boost::array的用法,以實(shí)例的形式簡單講述了靜態(tài)數(shù)組的容器boost::array的使用技巧,具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
本文實(shí)例講述了C++之boost::array的用法,分享給大家供大家參考。具體如下:
復(fù)制代碼 代碼如下:
#include <string>
#include <iostream>
#include <boost/array.hpp>
#include <algorithm>
using namespace std;
int main()
{
boost::array<int, 5> array_temp = {{12, 8, 45, 23, 9}};
sort(array_temp.begin(), array_temp.end());
copy(array_temp.begin(), array_temp.end(), ostream_iterator<int>(cout, " "));
return 0;
}
#include <iostream>
#include <boost/array.hpp>
#include <algorithm>
using namespace std;
int main()
{
boost::array<int, 5> array_temp = {{12, 8, 45, 23, 9}};
sort(array_temp.begin(), array_temp.end());
copy(array_temp.begin(), array_temp.end(), ostream_iterator<int>(cout, " "));
return 0;
}
希望本文所述對大家的C++程序設(shè)計(jì)有所幫助。
相關(guān)文章
Qt圖形圖像開發(fā)之QT滾動(dòng)區(qū)控件(滾動(dòng)條)QScrollArea的詳細(xì)方法用法圖解與實(shí)例
這篇文章主要介紹了Qt圖形圖像開發(fā),QT滾動(dòng)區(qū)控件(滾動(dòng)條)QScrollArea的詳細(xì)方法用法圖解與實(shí)例,需要的朋友可以參考下2020-03-03C++實(shí)現(xiàn)LeetCode(211.添加和查找單詞-數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì))
這篇文章主要介紹了C++實(shí)現(xiàn)LeetCode(211.添加和查找單詞-數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)),本篇文章通過簡要的案例,講解了該項(xiàng)技術(shù)的了解與使用,以下就是詳細(xì)內(nèi)容,需要的朋友可以參考下2021-08-08Windows 環(huán)境下使用 Qt 連接 MySQL
這篇文章主要介紹了Windows 環(huán)境下使用 Qt 連接 MySQL的相關(guān)資料,需要的朋友可以參考下2017-07-07C++中constexpr與函數(shù)參數(shù)轉(zhuǎn)發(fā)的操作方法
constexpr是c++11引入的關(guān)鍵字,c++11的constexpr的函數(shù)中只是支持單句代碼,c++14限制放寬,可以在里邊寫循環(huán)及邏輯判斷等語句,本文探討關(guān)于constexpr的函數(shù)中參數(shù)的現(xiàn)象,以及如果參數(shù)是constexpr如何做轉(zhuǎn)發(fā),感興趣的朋友一起看看吧2024-02-02