かなり面白かったので書いてみます。 代入する型が一致する場合 まずは小手調べ。簡単に代入できる場合までの処理。 Boost 1.40.0 では以下の実装になっています。 void variant_assign(const variant& rhs) { if (which_ == rhs.which_) { detail::variant::assign_storage visitor(rhs.storage_.address()); this->internal_apply_visitor(visitor); } else { assigner visitor(*this, rhs.which()); rhs.internal_apply_visitor(visitor); } } template <typename T> void assign(const T& rhs) { det