Skip to content

Commit 609de01

Browse files
committed
Fix missing self-contained header includes
Some stricter build environments require every public header to be self-contained. In other words, including and compiling any public header on its own must not depend on another header having happened to be included first. `SegmentTagged.hpp` previously worked under the common include paths used in this repository, but it did not declare `DictTrie` when compiled in isolation. Similarly, `HMMSegment.hpp` indirectly depended on `DictTrie.hpp` for `MIN_DOUBLE`. These implicit include dependencies can become real build failures when using stricter header parsing, modular builds, PCH/IWYU workflows, or simply a different include order. Add the missing direct includes so the affected headers are self-contained.
1 parent eed6bfe commit 609de01

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

include/cppjieba/DictTrie.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
#include "Trie.hpp"
2020

2121
namespace cppjieba {
22-
23-
const double MIN_DOUBLE = -3.14e+100;
24-
const double MAX_DOUBLE = 3.14e+100;
2522
const size_t DICT_COLUMN_NUM = 3;
2623
const char* const UNKNOWN_TAG = "";
2724

include/cppjieba/SegmentTagged.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
namespace cppjieba {
77

8+
class DictTrie;
9+
810
class SegmentTagged : public SegmentBase{
911
public:
1012
SegmentTagged() {

include/cppjieba/Utils.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ enum {
5656
LL_FATAL = 4,
5757
};
5858

59+
const double MIN_DOUBLE = -3.14e+100;
60+
const double MAX_DOUBLE = 3.14e+100;
61+
5962
static const char* const LOG_LEVEL_ARRAY[] = {"DEBUG", "INFO", "WARN", "ERROR", "FATAL"};
6063
static const char* const LOG_TIME_FORMAT = "%Y-%m-%d %H:%M:%S";
6164

0 commit comments

Comments
 (0)