A base column container, or a container of a base type, or a template derivative from a base type - all applicable.

The point here is that your puzzle should be turned inside out.

Instead of concentrating on obtaining a return type out of the column data, aimed at suiting the caller's need for a particular type, turn the puzzle inside out and call a generic operation which performs a callback based on the derived type.

Consider each of the reasons for the call, for which the ultimate type is required. It could be a calculation, it could be for display, it could be to obtain the data for another use. Whatever they are, form a collection of these based on the generic notion of the column. Let the virtual derivative deal with the actual method, which in turn calls an overload to respond appropriately based on type.

For example, say the purpose is calculation. Create a small collector, something like:


Code:
class sum_collector
{
 private:
 float sum;

 public:

 sum_collector() : sum( 0.0f ) {}

 accumulate( float &f ) { sum += f; }

};

create a sum_collector and pass it to a generic function which takes (or operates on) a column, without respect to type.

The virtual function which a "float" version responds with would call accumulate with it's float member, but if it's a string it would ignore the call.

The visitor pattern deals with this issue in a double dispatch scenario. Say, for example, your columns also included int and double types. In order to perform some operations with a combination of int, double and/or float, you'd need the visitor pattern, or some form of double dispatch to solve the issue.

There are various ways to consider and solve the puzzle, and virtual functions are generally at the heart of it. It is genuinely a mistake to insist the puzzle be solved from the caller's perspective. The caller should not have to know the type, it should be able to consider the call on whatever type - let the virtual derivative figure that out, and let it make a callback to complete the appropriate type-oriented behavior.