This document explains the supported features and limitations of the C++ language on the current platform.
Please adhere to the following rules to avoid using incompatible syntax features.
The following basic types are supported for declaration and usage:
char
, string
, bool
, int
, float
, double
Example:
The following containers and their nested forms are supported:
Container Type | Example |
---|---|
vector<T> | vector<int> nums3 |
vector<vector<T>> | 2D dynamic array |
map<T1, T2> | map<int, string> |
unordered_map<T1,T2> | Hash table |
queue<T> | Queue |
set<T> | Set |
unordered_set<T> | Set |
stack<T> | Stack |
Constraints:
- Keys in
map
/unordered_map
must be basic types (char/string/bool/int/float/double
). - Container nesting depth is limited to 2 levels (e.g.,
vector<vector<int>>
).
The following predefined structures can be directly used:
- Code must include a
main
function with anint
return type and explicitly return anint
.
- Supported: Functions and class methods (excluding static class methods).
- Supported: Lambda expressions, but variables must be explicitly captured (e.g.,
[&]{}
). - Common headers (e.g.,
<vector>
,<algorithm>
) are pre-included; no manual inclusion is needed.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <utility>
Category | Example | Remarks |
---|---|---|
Header Inclusion | #include <sstream> | Common libraries are pre-included |
Static Methods | MyClass::staticFunc() | Static class methods are unsupported |
Anonymous Lambdas (without & ) | [](){ ... } | Must use explicit capture like [&](){ ... } |
stringstream | ss << "text" | Use alternatives like to_string |
In-function Structs | void func() { struct X } | Structs must be defined globally or within a class |
- Incomplete class support; prioritize standalone functions or class methods.
- Avoid complex templates; custom template classes may fail to parse.
- Non-basic types as map keys are unsupported. Example of invalid code:
Adjust your code according to the above rules. Contact platform support if issues arise.