How to retrieve the parent uCalc instance from a Matches object and verify its identity.

ID: 859

				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();
t.Text = "some text";
t.Pattern("some");
t.Find();
var m = t.Matches;

// Get the parent uCalc instance from the Matches collection
var parent_uc = m.uCalc;

// Verify they are the same instance using their MemoryIndex
Console.WriteLine(parent_uc.MemoryIndex == uc.MemoryIndex);
				
			
True
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

#define tf(IsTrue) ((IsTrue) ? "True" : "False")

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   t.Text("some text");
   t.Pattern("some");
   t.Find();
   auto m = t.Matches();

   // Get the parent uCalc instance from the Matches collection
   auto parent_uc = m.uCalc();

   // Verify they are the same instance using their MemoryIndex
   cout << tf(parent_uc.MemoryIndex() == uc.MemoryIndex()) << endl;
}
				
			
True
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      t.Text = "some text"
      t.Pattern("some")
      t.Find()
      Dim m = t.Matches
      
      '// Get the parent uCalc instance from the Matches collection
      Dim parent_uc = m.uCalc
      
      '// Verify they are the same instance using their MemoryIndex
      Console.WriteLine(parent_uc.MemoryIndex = uc.MemoryIndex)
   End Sub
End Module
				
			
True