I think you can do this with:
if (Archive::is_saving::value)
doSomething();
This is inherited from the base interface that the Archives use, in boost/archive/detail/interface_[ia]archive.hpp
The following code demonstrates that it seems to be a reasonable solution with 1.42
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
// oarchive:
//text
static_assert(!boost::archive::text_oarchive::is_loading::value, "out is loading");
static_assert(boost::archive::text_oarchive::is_saving::value, "out isn't saving");
//xml
static_assert(!boost::archive::xml_oarchive::is_loading::value, "out is loading");
static_assert(boost::archive::xml_oarchive::is_saving::value, "out isn't saving");
// iarchive:
//text
static_assert(boost::archive::text_iarchive::is_loading::value, "out is loading");
static_assert(!boost::archive::text_iarchive::is_saving::value, "out isn't saving");
//xml
static_assert(boost::archive::xml_iarchive::is_loading::value, "out is loading");
static_assert(!boost::archive::xml_iarchive::is_saving::value, "out isn't saving");
I'd be a bit cautious of relying on something like this though -- multiple inheritance might break it if someone wrote an archive that does both input and output and it's not clear to me how permenant and public this part of the interface is meant to be.