Skip to content

Commit 03d4c95

Browse files
authored
Merge pull request #169 from QuBenhao/168-cpp-ranges-lib
feat: cpp submit with <ranges>
2 parents 974fbd5 + 4988e54 commit 03d4c95

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

python/lc_libs/cpp_writer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ def get_solution_code(
248248
final_codes.extend(content[start_index:end_index].strip().split("\n"))
249249
while final_codes and final_codes[0].strip() == "":
250250
final_codes.popleft()
251+
# special libs
252+
if "#include <ranges>" in content:
253+
# or " ranges::" in content or "std::ranges::" in content:
254+
final_codes.appendleft("#include <ranges>\n")
255+
logging.debug("Add special lib: <ranges>")
251256
return "\n".join(final_codes), problem_id
252257

253258
@staticmethod

0 commit comments

Comments
 (0)