ヘッダでusing-directiveを使う

  • using-declaration、typedef、Metafunction等で名前を持ってくる
  • VC8では恐るべきバグがあるようだ

[]#include[] []<boost/config.hpp>[]
[]#include[] []<boost/detail/workaround.hpp>[]

[]#include[] []<vector>[]

[]namespace[] []pstade[][] {[]

[]namespace[] []detail[][] {[]

[]using[] []namespace[] []std[][];[]

[]struct[] []abc[]
[] {[]
[]vector[][]<[][]int[][]> [][]vec[][];[]
[] };[]

[]template[][]< [][]class[] []T[][] >[]
[]struct[] []xyz[]
[] {[]
[]vector[][]<[][]T[][]> [][]vec[][];[]
[] };[]

[]} [][]// namespace detail[]


[]// test[]
[]// #define BOOST_NO_USING_TEMPLATE[]
[]// #define PSTADE_NO_USING[]

[]// pull names to the pstade namespace...[]

[]#if[][] !defined(PSTADE_NO_USING)[]
[]using[] []detail[][]::[][]abc[][];[]
[]#else[]
[]typedef[] []detail[][]::[][]abc[] []abc[][];[]
[]#endif[]

[]#if[][] !defined(BOOST_NO_USING_TEMPLATE)[]
[]using[] []detail[][]::[][]xyz[][];[]
[]#else[]
[]template[][]< [][]class[] []T[][] >[]
[]struct[] []xyz[]
[] {[]
[]typedef[] []detail[][]::[][]xyz[][]<[][]T[][]> [][]type[][];[]
[] };[]
[]#endif[]

[]} [][]// namespace pstade[]

[]#include[] []<string>[]

[]int[] []main[][]()[]
[]{[]
[]pstade[][]::[][]abc[] []a[][];[]

[]#if[][] !defined(BOOST_NO_USING_TEMPLATE)[]
[]pstade[][]::[][]xyz[][]<[][]int[][]> [][]x[][];[]
[]#else[]
[]pstade[][]::[][]xyz[][]<[][]int[][]>::[][]type[] []x[][];[]
[]#endif[]

[]#if[][] BOOST_WORKAROUND(BOOST_MSVC, == 1400) []
[]using[] []namespace[] []pstade[][];[]
[]string[] []str[][]; [][]// まさか![]
[]#endif[]

[]return[] []0[][];[]
[]}[]