コード例 #1
0
inline std::ostream& show(std::ostream& os, const std::tuple<T,R...>& v) {
    show_each(v, os);
    os << " : std::tuple<";
    typedef const std::tuple<T,R...>& tuple_t;
    TupleTypesPrinter<tuple_t,1+sizeof...(R)>::print(os,v);
    os << ">";
    return os;
}
コード例 #2
0
std::ostream& show(std::ostream& os,
                   const pnw::histogram::ngram::tree<V,C,L>& a) {
    show_each(os, a);
    os << " : pnw::histogram::ngram::pnw::histogram::ngram::tree<"
       << "V=" << typenameof<V>() << ","
       << "C=" << typenameof<C>() << ","
       << "L=" << typenameof<L>() << ">";
    return os;
}
コード例 #3
0
/*! Print Each Element in STL Container \c C \p v to \p os. */
template<class C> inline
typename std::enable_if<is_container<C>::value,
                        std::ostream>::type&
show_each(const C& v,
          std::ostream& os = std::cout,
          const char* opening = "[",
          const char* closing = "]",
          const char* separator = " ") {
    return show_each(begin(v), end(v), os, opening, closing, separator);
}
コード例 #4
0
std::ostream& show_each(std::ostream& os,
                        const pnw::histogram::ngram::tree<V,C,L>& a) {
    bool flag2d = false;
    os << "{@" << static_cast<int>(a.level()) << ":";
    if (flag2d) { os << std::endl; } else { os << " "; }
    for (auto& e : a.map().get()) {
        auto& val = e.first;        // value
        auto& cnt = e.second.first; // count
        const auto& sub = e.second.second.get();
        if (flag2d) { os_spaces(os, a.level()); }
        show(os, val); os << SEPCH; show(os, cnt);
        if (sub and not sub->empty()) {
            os << "→";
            show_each(os, *sub);
        }
        if (flag2d) { os << std::endl; } else { os << " "; }
    }
    os << "}";
    if (flag2d) { os << std::endl; }
    return os;
}
コード例 #5
0
inline std::ostream& operator << (std::ostream& os,
                                  const std::pair<T,U>& v) {
    return show_each(v, os);
}
コード例 #6
0
inline std::ostream& operator << (std::ostream& os, const std::bitset<N>& v) {
    show_each(v, os, "[", "]");
    os << " : std::bitset<" << N << ">";
    return os;
}