Skip to content

add string vector support#56

Closed
jianbingfang wants to merge 2 commits intoArashPartow:masterfrom
jianbingfang:feature/add-strvec
Closed

add string vector support#56
jianbingfang wants to merge 2 commits intoArashPartow:masterfrom
jianbingfang:feature/add-strvec

Conversation

@jianbingfang
Copy link
Copy Markdown

This PR adds two major features to ExprTk:

  1. String vector (std::vectorstd::string) as a first-class symbol type — register, access, assign, and operate on string vectors directly in expressions.
  2. Vector return types for igeneric_function — generic functions can now return std::vector or std::vectorstd::string, retrieved via new expression::vec() and expression::strvec() APIs.

fangjianbing02 and others added 2 commits April 24, 2026 10:09
Enable registration, access, assignment, and string operations on
string vector data. All changes guarded by exprtk_disable_string_capabilities.

New features:
- add_string_vector() / add_string_vector("name", vec, is_constant)
- names[] for size, names[i] for element access (const & dynamic index)
- names[0] := 'hello' element assignment with const protection
- names[0] + names[1] concatenation, 'foo' in names[0], names[0] like '*x*'
- names[2][1:5] substring range on elements
- igeneric_function 'L' parameter type for string vector arguments
- RTC (runtime check) variants for bounds checking

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ction

Extends ExprTk generic function return type system with two new types:
- e_rtrn_vector (3): function returns std::vector<T>, retrieved via expression::vec()
- e_rtrn_str_vector (4): function returns std::vector<std::string>, retrieved via expression::strvec()

Key changes:
- igeneric_function: add e_rtrn_vector/e_rtrn_str_vector enum values and 4 new operator() overloads
- New node classes: vector_function_node, multimode_vecfunction_node, str_vector_function_node, multimode_strvecfunction_node
- New string_vector_interface<T> for dynamic_cast-based result retrieval
- symbol_table: vector_function_store, str_vector_function_store, add_function routing, getters
- Parser: parse_vector_function_call, parse_str_vector_function_call, symbol resolution routing
- expression_generator: vector_function_call, str_vector_function_call synthesis methods
- expression: vec() and strvec() retrieval APIs
- All 23 exprtk_test cases pass; 47 string-vector tests pass; 28 new vec-return tests pass

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@prdevbot prdevbot closed this Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants