ネタ元:blog.y4su0.com - gcc 4.3.1 を Windows で使ってみる
Windows用にビルドされたGCCのバイナリがあると聞いたのでインストールしてみました。
ここからgcc 4.4-20090123のsnapshot版をダウンロードして、インストーラを使ってインストール
とても簡単です。
(cygwinは事前インストールが必要cygwinをインストールしなくても、コマンドプロンプトだけで実行可能です)
まず言語仕様
#include <vector>
struct X {
X() = delete;
X(const X&) = default;
};
enum class E : int { A = 0, B };
namespace std {
inline namespace tr1 {
template <class T, int N>
class array {};
}
}
template <class T, class U>
auto plus(T a, U b) -> decltype(a + b) { return a + b; }
int main()
{
std::vector<int> v = {1, 2, 3};
const auto& a = v;
E e = E::A;
std::array<int, 3> ar;
std::tr1::array<int, 3> arr;
int result = plus(1, 2);
}
動いた〜。
次にライブラリ
chrono
#include <chrono>
using namespace std::chrono;
int main()
{
auto go = system_clock::now() + nanoseconds(500);
while (system_clock::now() < go);
}
forward_list
#include <iostream>
#include <iterator>
#include <forward_list>
#include <algorithm>
using namespace std;
int main()
{
forward_list<int> ls;
ls.push_front(3);
ls.insert_after(ls.begin(), 1);
size_t size = distance(ls.begin(), ls.end());
copy(ls.begin(), ls.end(), ostream_iterator<int>(cout, "\n"));
}
Placement Insert
#include <vector>
struct hoge {
hoge(int a, int b, int c) {}
};
int main()
{
std::vector<hoge> v;
v.emplace_back(1, 2, 3);
v.emplace(v.begin(), 3, 2, 1);
}
使ってないけどとかもありますよ。
GCC 4.4のC++0x対応状況は以下を参照
Status of Experimental C++0x Support in GCC 4.4