def load_atomic(val):
    """
    Load a std::atomic<T>'s value.
    """
    valty = val.type.template_argument(0)
    # XXX This assumes std::atomic<T> has the same layout as a raw T.
    return val.address.reinterpret_cast(valty.pointer()).dereference()