CPP09
1.0
読み取り中…
検索中…
一致する文字列を見つけられません
RPN.hpp
[詳解]
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* RPN.hpp :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2025/08/28 19:08:00 by kamitsui #+# #+# */
9
/* Updated: 2025/08/28 19:12:33 by kamitsui ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
17
#ifndef RPN_HPP
18
#define RPN_HPP
19
20
#include <
cstdlib
>
21
#include <
iostream
>
22
#include <
sstream
>
23
#include <
stack
>
24
#include <
stdexcept
>
25
#include <
string
>
26
35
class
RPN
{
36
private
:
44
std::stack<int>
_stack;
45
46
// Orthodox Canonical Form: コピーを禁止するためにprivateで宣言
47
RPN
(
const
RPN
&src);
48
RPN
&operator=(
const
RPN
&rhs);
49
50
// --- Private Helper Methods ---
51
57
bool
isOperator(
const
std::string
&token)
const
;
58
64
void
performOperation(
char
op);
65
66
public
:
70
RPN
();
74
~RPN
();
75
85
void
evaluate
(
const
std::string
&expression);
86
};
87
88
#endif
// RPN_HPP
std::string
RPN
逆ポーランド記法の数式を評価するためのクラス。
Definition
RPN.hpp:35
RPN::RPN
RPN()
デフォルトコンストラクタ。
Definition
RPN.cpp:21
RPN::evaluate
void evaluate(const std::string &expression)
逆ポーランド記法の数式文字列を評価します。
Definition
RPN.cpp:80
RPN::~RPN
~RPN()
デストラクタ。
Definition
RPN.cpp:23
cstdlib
iostream
sstream
stack
stdexcept
string
ex01
RPN.hpp
構築:
1.9.8