Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3668478
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:07:39+00:00 2026-05-19T02:07:39+00:00

type TSomething = record name: string; value: integer; end; type TOtherSomething = record data:

  • 0
type TSomething = record
 name: string;
 value: integer;
end;    
type TOtherSomething = record
 data: extended;
 data2: extended;
 data3: array of TSomethingAlien;
end;
...
dynarray1: array of TSomething;
dynarray2: array of TOtherSomething;

Also, there’s nasty procedure of deleting elements for each type:

procedure TForm1.DeleteSomething(N: integer);
begin
   if N > High(dynarray1) then Exit;
   if N < Low(dynarray1) then Exit;
   if N = High(dynarray1) then begin
     SetLength(dynarray1, Length(dynarray1) - 1);
     Exit;
   end;
   Finalize(dynarray1[N]) ;
   System.Move(dynarray1[N +1], dynarray1[N],(Length(dynarray1) - N  -1) * SizeOf(TSomething) + 1) ;
   setLength(dynarray1, Length(dynarray1) - 1) ;
end;                          

procedure TForm1.DeleteOtherSomething(N: integer);
... got the idea?

Binding the procedure to global object wasn’t smart, but compiler groaned, when a var Dyna: array of TSomething was in function arguments, so Dyna was used instead of addressing to dynarray1. So I even can’t overload the function for multiple data types with var argument!
SetLength(Dyna, length(dynarray1)
type mismatch!
SetLength(Dyna, length(Dyna)
type mismatch!

What is wanted:

  1. Overloaded DeleteElement(var Arr: TMultipleTypes, N: element): see above, why can’t reach this goal.

  2. single DeleteElement implementation that works with any type of data in array? Something like <template> type support?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:07:39+00:00Added an answer on May 19, 2026 at 2:07 am

    Well, normal tlist class does most of this stuff, but is based on an array of pointers

    The generic “tfplist” (requires 2.4.0+, see fgl unit) might be closer to what you want. But generics are still beta.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this Javascript data: [{id:123,type:test},{id:154,type:another}] How would you transform that into something so
Type.GetType(System.String) Is there a lookup for the aliases available somewhere? Type.GetType(string) returns null .
For example, if you type something in upper-right google/yahoo search box in firefox there
Today I discovered something that makes me sad: objects of type System.Generic.Collections.List don't have
I saw something about needing to have the assembly available for the type of
I need to display something such as below. Type A Type A Item 1
I have a standalone enum type defined, something like this: package my.pkg.types; public enum
I seem to be getting a type mismatch error when trying to do something
For example, given a type param method i'm looking for something like the part
Which type of input is least vulnerable to Cross-Site Scripting (XSS) and SQL Injection

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.