This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdexcept> | |
template <typename Item> | |
class Deque | |
{ | |
class iterator; | |
class node; | |
public: | |
Deque() = default; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#include <tuple> | |
// Sequence of integers to index the elements of the tuple | |
template <std::size_t... Indices> | |
struct index_sequence { | |
typedef index_sequence<Indices..., sizeof...(Indices)> next; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#include <tuple> | |
template <bool...> | |
struct bool_sequence { }; | |
template <bool... Bs> | |
using bool_and = std::is_same<bool_sequence<Bs...>, | |
bool_sequence<(Bs || true)...>>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#include <tuple> | |
namespace detail | |
{ | |
template <typename value, typename tuple> | |
struct has_type; | |
template <typename value, typename... xs> | |
struct has_type<value, std::tuple<xs...>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <tuple> | |
#include <type_traits> | |
#include <utility> | |
#include <integer_sequence> | |
template <class F, class Tuple, size_t... I> | |
auto tuple_map_impl(F f, Tuple&& t, index_sequence<I...>) | |
{ | |
return std::make_tuple(f(std::get<I>(std::forward<Tuple>(t)))...); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
template<class T> | |
struct wrap_impl | |
{ | |
wrap_impl(T&& x) : data(std::forward<T>(x)) { } | |
T get() const & { return data; } | |
T&& get() && { return std::move(data); } | |
private: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <stack> | |
void calculate(std::stack<int>& numbers, std::stack<char>& operators); | |
int main() | |
{ | |
std::stack<int> numbers; | |
std::stack<char> operators; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
struct filename_facet : std::locale::facet | |
{ | |
private: | |
std::string m_name; | |
public: | |
filename_facet(std::string const& name, std::size_t refs = 0) | |
: std::locale::facet(refs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <sstream> | |
#include <string> | |
#include <boost/io/ios_state.hpp> | |
template <class cT> | |
class whitespace_fmt; | |
template <> | |
class whitespace_fmt<char> : public std::ctype<char> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <sstream> | |
class whitespace_fmt : public std::ctype<char> | |
{ | |
mask table[table_size]; | |
public: | |
whitespace_fmt(size_t refs = 0) | |
: std::ctype<char>(table, false, refs) | |
{ |