help problem convert this script from java to c + +

Hello
O great problem to convert this line of code in java to c + +
I do not know much about c + +, so I ask you to help those who are familiar with C + +
when i try to convert from java to c + + I get this error:
Can not modify a value type return value of `UnityEngine.Transform.position '. Consider storing the value in a temporary variable
Thanks for Help

This original code java:

var Player : GameObject;

function Start () {
}

function Update () {
	 
	 transform.position.x = Mathf.Lerp(transform.position.x ,Player.transform.position.x ,3 * Time.deltaTime);
	 
}

If you Google for your error message, you will find many answers. As indicated by the error message, you have to use a temporary variable. Also note the two languages are C# and Javascript. ‘Java’ and ‘C++’ are both different programming languages from the ones used in Unity.

Vector3 pos = transform.position;
pos.x = Mathf.Lerp(transform.position.x ,Player.transform.position.x ,3 * Time.deltaTime);
transform.position = pos;