Skip to content

TypedArray<T> operator [] returning Variant makes little sence. #1482

Open
@RonYanDaik

Description

@RonYanDaik

Godot version

4.2

godot-cpp version

4.2

System information

Win 10

Issue description

When using TypedArray I think the one would expect that accessing entries with operator [] will return you variable of type T. Instead it returns Variant, which is loosing all point to use TypedArray in first place.

This should give compilation error:

TypedArray<Node> a; 
Dictionaty d = a[0];

As well as this construction is a bit annoying:

TypedArray<Node> a; 
Node* n = (Node*) (Object*) a[0]; //beacuse varinat can only  be cast to Object*

Steps to reproduce

Minimal reproduction project

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionenhancementThis is an enhancement on the current functionality

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions