# Casting SiteSet into appropriate type

+1 vote

I am writing a generic code that may allow for different SiteSet types, such as different values of spin. My code works fine, unless I save the SiteSet to memory, and then try to load it. As an example, I may have something like

SiteSet sites;
sites = SpinHalf(N);

Since sites is actually of type SpinHalf at run time, there is no issue. However, If I then try to save and then load this variable via

write(f, sites);

sites is now a basic site set, and thus loses operations such as 'op'. Is there a simple way to get around this, so I can keep my code general? Or do I have to, for example, write different code for each type of SiteSet?

Thanks,
Nick

+1 vote
    auto sType = args->getString("SiteSet");