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 <algorithm> | |
#include <string> | |
#include <vector> | |
#include <fstream> | |
#include <iterator> | |
#include <iostream> | |
#include <utilities/timer.hpp> | |
int main() { |
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 <vector> | |
#include <iostream> | |
#include <fstream> | |
std::vector<unsigned> calculate_frequencies(std::istream& stream) { | |
auto frequencies = std::vector<unsigned>(0x100); | |
auto c = char{}; | |
while (stream.get(c)) { | |
if(!std::isspace(c) and !std::ispunct(c)) { | |
++frequencies.at(static_cast<unsigned char>(c)); |
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 <algorithm> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
float read_rain(unsigned month); | |
float get_total(const std::vector<float>& data); | |
unsigned find_min(const std::vector<float>& data); | |
unsigned find_max(const std::vector<float>& data); |
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> | |
class vehicle { | |
public: | |
vehicle(const std::string& model, const std::string& color, unsigned year, unsigned price): | |
m_model{model}, m_color{color}, m_year{year}, m_price{price} {} | |
// we have a virtual method, so we should make the dtor virtual too: | |
virtual ~vehicle() = 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 <array> | |
#include <cassert> | |
#include <string> | |
#include <algorithm> | |
#include <iterator> | |
#include <map> | |
#include <ostream> | |
#include <iostream> | |
#include <vector> |
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
#ifndef MULTI_ARRAY_HPP | |
#define MULTI_ARRAY_HPP | |
#include <array> | |
#include <cstdint> | |
namespace multi { | |
namespace impl { |
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 <algorithm> | |
#include <string> | |
#include <vector> | |
#include <type_traits> | |
#include <functional> | |
#include <iostream> | |
template<typename T> | |
using fn = 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 <algorithm> | |
#include <cstdint> | |
#include <experimental/string_view> // already works in g++ 4.9.1 | |
//format("{bla}, {blub}", "bla"_id = 3, "blub"_id = "foobar"); | |
using std::experimental::string_view; | |
template<typename 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
mod tu1; | |
fn main() { | |
println!("Hello World"); | |
tu1::fun1(); | |
} |
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 <algorithm> | |
#include <string> | |
#include <vector> | |
#include <yoga/yoga.hpp> | |
template<typename Functions> | |
class basic_raii { |