Refactor comments and typedef
This commit is contained in:
parent
ec1d64e9ba
commit
734588316d
1 changed files with 2 additions and 3 deletions
5
file.hpp
5
file.hpp
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
typedef unsigned long long count_type;
|
typedef unsigned long long count_type;
|
||||||
class line;
|
|
||||||
typedef std::pair<line*, line*> two_lines;
|
|
||||||
|
|
||||||
// Treap node representation of a line
|
// Treap node representation of a line
|
||||||
struct line {
|
struct line {
|
||||||
|
@ -15,6 +13,7 @@ struct line {
|
||||||
|
|
||||||
line(count_type _p, string _t) : priority(_p), text(_t), size(1), left(nullptr), right(nullptr) {}
|
line(count_type _p, string _t) : priority(_p), text(_t), size(1), left(nullptr), right(nullptr) {}
|
||||||
};
|
};
|
||||||
|
typedef std::pair<line*, line*> two_lines;
|
||||||
|
|
||||||
// Treap representation of a file
|
// Treap representation of a file
|
||||||
class file {
|
class file {
|
||||||
|
@ -83,10 +82,10 @@ public:
|
||||||
root = nullptr;
|
root = nullptr;
|
||||||
}
|
}
|
||||||
// File access
|
// File access
|
||||||
// Don't find index k, but k-th line -> +1
|
|
||||||
line* find(count_type k) {
|
line* find(count_type k) {
|
||||||
if(k >= root->size)
|
if(k >= root->size)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
// Don't find index k, but k-th line -> +1
|
||||||
return find(root, k+1);
|
return find(root, k+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue