C++0x module

post-c++0x: modules in c++


module かー・・・

ヘッダーファイルごとじゃなくてライブラリごとに管理できるようにする提案かな

export std:
public:
  namespace std {
    template <class T, class Allocator>
    class vector;
  }
import std;

int main()
{
    std::vector<int> v;
    return 0;
}

むしろ、ファイル内だけで using directive できる仕組みがほしい(module とあんまり関係ないけど)

// hoge.h
using namespace std { // こんなふうに書けたらいいなー

class hoge {
  vector<string> v;
};

} // using namespace std
// main.cpp
#include "hoge.h"

int main()
{
    vector<string> v;           // エラーになってほしい
    std::vector<std::string> v; // OK

    return 0;
}


N2316 - Modules in C++ (Revision 5)