Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A simple unoptimized integer set for fortran.

License

NotificationsYou must be signed in to change notification settings

jordan4ibanez/integer_set

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple unoptimized integer set for fortran.

Contains:

  • int32_set
  • int64_set

Add to your project:

[dependencies]integer_set = {git ="https://github.com/jordan4ibanez/integer_set" }

Example:

program tutorial  use,intrinsic:: iso_c_binding  use:: integer32_setimplicit none  type(int32_set):: my_setinteger(c_int32_t):: i  ! Ensure that you create the memory for the set using this built-in method.  my_set= new_int32_set()  ! Let us add somedata, backwards.do i=10,1,-1call my_set%push(i)end doprint*,"size:",my_set%size  ! Now let us push it backin forwards.do i=1,10call my_set%push(i)end do  ! The size is still10.print*,"size:",my_set%sizeprint*,my_set%data  ! We can get itto go from min->max using the sort method.call my_set%sort()print*,"size:",my_set%sizeprint*,my_set%data  ! Suppose we wantto remove the even numbers.do i=0,10,2call my_set%pop(i)end doprint*,"size:",my_set%size  ! Tada.print*,my_set%data  !! Don not forgetto destroy the memory. :)call my_set%destroy()  ! Which will give you a size of-1.print*,my_set%size  ! Andthen you just use the new_int32_set functionto re-use the variable.  ! Using int64_set is literally the same, but you are using c_int64_t.end program tutorial

About

A simple unoptimized integer set for fortran.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp