This file contains 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
use std::convert::TryFrom; | |
use thiserror::Error; | |
#[derive(Debug, Error)] | |
enum Error { | |
#[error("Invalid varint")] | |
InvalidVarint, | |
#[error("Invalid wire-type")] | |
InvalidWireType, | |
#[error("Unexpected EOF")] |
This file contains 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
// TODO: remove this when you're done with your implementation. | |
#![allow(unused_variables, dead_code)] | |
#![allow(dead_code)] | |
pub struct User { | |
name: String, | |
age: u32, | |
height: f32, | |
visit_count: usize, |
This file contains 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
/// A node in the binary tree. | |
#[derive(Debug)] | |
struct Node<T: Ord> { | |
value: T, | |
left: Subtree<T>, | |
right: Subtree<T>, | |
} | |
/// A possibly-empty subtree. | |
#[derive(Debug)] |
This file contains 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> | |
enum States { IDLE, MOVE, YUMYUM, EAT, DIE, CLEAR, FINISH }; | |
void RunLogic(States); | |
int main() | |
{ | |
// FSM : Finite State Machine (유한 상태 기계) |
This file contains 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 <cassert> | |
template <class T, class... TArgs> decltype(void(T{std::declval<TArgs>()...}), std::true_type{}) test_is_braces_constructible(int); | |
template <class, class...> std::false_type test_is_braces_constructible(...); | |
template <class T, class... TArgs> using is_braces_constructible = decltype(test_is_braces_constructible<T, TArgs...>(0)); | |
struct any_type { | |
template<class T> |
This file contains 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
//! Splits a string \p str using \p delim. | |
//! \param str An original string. | |
//! \param delim A string delimiter to split. | |
//! \return A splitted string. | |
inline std::vector<std::string> SplitString(const std::string& str, | |
const std::string& delim) | |
{ | |
std::vector<std::string> tokens; | |
std::size_t prev = 0, pos; |
This file contains 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 <class T> | |
class SimplePointer { | |
T* ptr; | |
int size; | |
void boundarychk(int idx); | |
public: | |
SimplePointer(); |
This file contains 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
// ------------------------------------------- SPELL - MAGE | |
// [DRG_321] Rolling Fireball - COST:5 | |
// - Set: Dragons, Rarity: Epic | |
// -------------------------------------------------------- | |
// Text: Deal 8 damage to a minion. Any excess damage | |
// continues to the left or right. | |
// -------------------------------------------------------- | |
// GameTag: | |
// - ImmuneToSpellpower = 1 | |
// -------------------------------------------------------- |
This file contains 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
// ---------------------------------------- MINION - PRIEST | |
// [DRG_306] Envoy of Lazul - COST:2 [ATK:2/HP:2] | |
// - Set: Dragons, Rarity: Epic | |
// -------------------------------------------------------- | |
// Text: <b>Battlecry:</b> Look at 3 cards. | |
// Guess which one is in your opponent's hand | |
// to get a copy of it. | |
// -------------------------------------------------------- | |
// GameTag: | |
// - BATTLECRY = 1 |
This file contains 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
class A | |
{ | |
public: | |
static std::unique_ptr<IEffect> AttackN(int n) | |
{ | |
return B::Attack(n); | |
} | |
static std::unique_ptr<IEffect> HealthN(int n) | |
{ |
NewerOlder