# Differences

This shows you the differences between two versions of the page.

ada.containers.vectors [2012/01/24 08:02] thomaslocke [Vectors.Has_Element] |
ada.containers.vectors [2012/01/24 08:10] (current) thomaslocke [Equality] |
||
---|---|---|---|

Line 2265: | Line 2265: | ||

The important thing to take away from this example, is the //No_Element// part. If the given //Index// is out of range, then //No_Element// is returned. | The important thing to take away from this example, is the //No_Element// part. If the given //Index// is out of range, then //No_Element// is returned. | ||

- | [[Vectors.To_Cursor|Example Source]] | + | [[Vectors.To_Cursor|Vectors.To_Cursor Example Source]] |

==== Vectors.To_Index ==== | ==== Vectors.To_Index ==== | ||

Line 2298: | Line 2298: | ||

This is not exactly rocket science, but it is worth noting that //No_Element// is "transformed" into //No_Index// when //To_Index// is called on a cursor which point at //No_Element//. | This is not exactly rocket science, but it is worth noting that //No_Element// is "transformed" into //No_Index// when //To_Index// is called on a cursor which point at //No_Element//. | ||

- | [[Vectors.To_Index|Example Source]] | + | [[Vectors.To_Index|Vectors.To_Index Example Source]] |

===== Vectors.Generic_Sorting ===== | ===== Vectors.Generic_Sorting ===== | ||

Line 2359: | Line 2359: | ||

And there you have it: A perfectly sorted //quotes.txt// file. It just doesn't get any simpler than that. | And there you have it: A perfectly sorted //quotes.txt// file. It just doesn't get any simpler than that. | ||

- | [[Vectors.Generic_Sorting.Sort|Example Source]] | + | [[Vectors.Generic_Sorting.Sort|Vectors.Generic_Sorting.Sort Example Source]] |

==== Generic_Sorting.Is_Sorted ==== | ==== Generic_Sorting.Is_Sorted ==== | ||

Line 2410: | Line 2410: | ||

In case of large vectors, this is not very efficient. Given that, you should of course only use //Is_Sorted// if it's absolutely necessary. | In case of large vectors, this is not very efficient. Given that, you should of course only use //Is_Sorted// if it's absolutely necessary. | ||

- | [[Vectors.Generic_Sorting.Is_Sorted|Example Source]] | + | [[Vectors.Generic_Sorting.Is_Sorted|Vectors.Generic_Sorting.Is_Sorted Example Source]] |

==== Generic_Sorting.Merge ==== | ==== Generic_Sorting.Merge ==== | ||

Line 2484: | Line 2484: | ||

When using //Merge// it is very important to remember this: Both the //Target// and //Source// vectors **must** be sorted prior to the //Merge// call, else you'll end up with an un-sorted vector as the result. (If that is all you want, then it's probably faster to use one of the following procedures: [[Ada.Containers.Vectors#Vectors.Append | Append]], [[Ada.Containers.Vectors#Vectors.Insert | Insert]], [[Ada.Containers.Vectors#Vectors.Prepend | Prepend]]. Or you could simply use the //&// function to get the job done.) | When using //Merge// it is very important to remember this: Both the //Target// and //Source// vectors **must** be sorted prior to the //Merge// call, else you'll end up with an un-sorted vector as the result. (If that is all you want, then it's probably faster to use one of the following procedures: [[Ada.Containers.Vectors#Vectors.Append | Append]], [[Ada.Containers.Vectors#Vectors.Insert | Insert]], [[Ada.Containers.Vectors#Vectors.Prepend | Prepend]]. Or you could simply use the //&// function to get the job done.) | ||

- | [[Vectors.Generic_Sorting.Merge|Example Source]] | + | [[Vectors.Generic_Sorting.Merge|Vectors.Generic_Sorting.Merge Example Source]] |

===== Concatenate using the & operator ===== | ===== Concatenate using the & operator ===== | ||

Line 2632: | Line 2632: | ||

If you care about performance, it is probably best to avoid using the "&" functions. As the simple benchmark shows, there are faster ways to concatenate vectors and/or vector elements than using "&". | If you care about performance, it is probably best to avoid using the "&" functions. As the simple benchmark shows, there are faster ways to concatenate vectors and/or vector elements than using "&". | ||

- | [[The|& operator Example Source]] | + | [[The & operator Example Source|The & operator Example Source]] |

===== Equality ===== | ===== Equality ===== | ||

Line 2669: | Line 2669: | ||

This is of course as expected. | This is of course as expected. | ||

- | [[Equality|Example Source]] | + | [[Equality|Equality Example Source]] |