Chess Programming – Principal Variation and Transposition Tables

Right now I am currently trying to implement a principal variation search algorithm for my chess engine (C++) as well as a transposition table. I have looked at various sources online and have become confused on how to properly store the principal variation. I have seen some sources/implementations use a seperate array of structs that can be indexed at a certain depth to extract the pv move and I have also heard about people storing the principal variation moves within the transposition table. Therefore I have a few questions that I would like to ask to perhapse clear my mistunderstanding.

  1. Should I or should I not have a seperate array to store the principal variation and store it in the transposition table. Which is better?

  2. If I store it in the transposition table the same as other moves, how would I go about preventing that entry from getting overwritten by another move????

  3. Or am I thinking about this wrong? What then is the proper way to do this?