In parallel to the unified construction of relativistic Hamiltonians based solely on physical arguments (J. Chem. Phys. 2024, 160, 084111), a unified implementation of relativistic wave function methods is achieved here via programming techniques (e.g., template metaprogramming and polymorphism in C++). That is, once the code for constructing the Hamiltonian matrix is made ready, all the rest can be generated automatically from existing templates used for the nonrelativistic counterparts. This is facilitated by decomposing a second-quantized relativistic Hamiltonian into diagrams that are topologically the same as those required for computing the basic coupling coefficients between spin-free configuration state functions (CSF). Moreover, both time reversal and binary double point group symmetries can readily be incorporated into molecular integrals and Hamiltonian matrix elements. The latter can first be evaluated in the space of (randomly selected) spin-dependent determinants and then transformed to that of spin-dependent CSFs, thanks to simple relations in between. As a showcase, we consider here the no-pair four-component relativistic iterative configuration interaction with selection and perturbation correction (4C-iCIPT2), which is a natural extension of the spin-free iCIPT2 (J. Chem. Theory Comput. 2021, 17, 949), and can provide near-exact numerical results within the manifold of positive energy states (PES), as demonstrated by numerical examples.