GetSectionLength,GetSectionMetadata in UMyAnimInstance

I have this code to query UAnimMontage data, GetSectionLength and GetSectionMetaData), in my AnimInstance.
This code worked for the time being.
But I’m new to C++, so I’m not sure whether this code is correct or having something wrong.
I’d like you to see this code, and if there are something wrong, please point out problem.

UMyAnimInstance.h

    #pragma once
    
    #include "Animation/AnimInstance.h"
    #include "MyAnimInstance.generated.h"
    
    /**
     * 
     */
    UCLASS()
    class AITEST411_API UMyAnimInstance : public UAnimInstance
    {
    	GENERATED_BODY()
    
    public:
    
    	UFUNCTION(BlueprintCallable, Category = "MyFunction")
    	float GetCurrentSectionLength(UAnimMontage * Montage, FName SectionName);
    
    	UFUNCTION(BlueprintCallable, Category = "MyFunction")
    	TArray< class UAnimMetaData * > GetCurrentMetaData(UAnimMontage * Montage, FName PlayingSection);
    
    };

UMyAnimInstance.cpp

    #include "AItest411.h"
    #include "MyAnimInstance.h"
    
    float UMyAnimInstance::GetCurrentSectionLength(UAnimMontage * Montage, FName SectionName)
    {
    	int32 SectionIndex = Montage->GetSectionIndex(SectionName);
    
    	return Montage->GetSectionLength(SectionIndex);
    }
    
    TArray< class UAnimMetaData * > UMyAnimInstance::GetCurrentMetaData(UAnimMontage * Montage, FName PlyaingSection)
    {
    
    	FName SectionName = PlyaingSection;
    
    	return Montage->GetSectionMetaData(SectionName);
    
    }

Sorry for my poor English, and strange Question.
And I’ve also posted this question Japanese Section , QuestionPost, because of there is few C++ user.
Again, I’m sorry for multi-post, but if answerd in Japanese Section, I’ll report here!

I’m sorry to leave it unsolved for a long time
Although it was able to be used without problems with the above code, I decided to use another way because the simpler method. The specific method is to create your own AnimNotifyBP and make the variable editable
Place that AnimNotify in animation notification and set the variable
And pass that variable from ReceiveNotify function to AnimInstance