user10209: I'd like to write a function like this:
void lcdPositionPrint(int row, int col,  content) {
    lcdPosition(row, col);
    LCD.print(content);
}

but I'm not certain how to declare "content", because it might be a string, or an int, or who knows what, just as it is for the "Serial.print" function or the LCD.print() function. Is there an easy way to do this? 

user368: One way to do this is to use generics. And we also need to use an unnamed namespace to get around the IDE's "helpfulness":
namespace {
    template<typename T>
    void lcdPositionPrint(int row, int col, T content) {
        lcdPosition(row, col);
        LCD.print(content);
    }
}

This will cause the compiler to create one function for each type passed in content that the function is actually called with.

user1585: There isn't really a great way to do it, but there are a few ways to get it to work. Most of the problem here is that there is actually a different LCD.print function for every data type. You aren't really calling the same function, your calling different functions that share the same name.
You could use templates. They are a powerful system built into C plus plus for generating functions and avr-gcc supports them well. With them, you can make the compiler generate all the necessary versions of your function for you. Your function would then look like this:
template<typename T>
void lcdPositionPrint(int x, int y, T content) throw() {
  lcdPosition(row, col);
  LCD.print(content);
}

That part about throw() isn't doing anything except keeping the ".ino" preprocessor from messing the template function up. You can call the templated function like normal, or with an explicit type 
lcdPositionPrint(0,0,"hello");
lcdPositionPrint<float>(0,0,32.0f);

You could also use the preprocessor. Your function is very simple, so you could just as easily make it a preprocessor macro that just places you code you want in the file whenever your "function call" appears. It looks like this:
#define lcdPositionPrint2(row,col,content) \
    do { lcdPosition(row, col); LCD.print(content); } while (0)

The \ there tells the preprocessor that the next line is also part of the macro, and you will need one on every line but the last of your function. Wrapping it in a do loop that immediately ends makes it nicely substitute into more situations. Micros don't scale up well, but they are a bit simpler for quick debugging situations. The code is duplicated in each call location instead of being bundled into functions though.

10209: <p>I'd like to write a function like this:</p>

<pre><code>void lcdPositionPrint(int row, int col,  content) {
    lcdPosition(row, col);
    LCD.print(content);
}
</code></pre>

<p>but I'm not certain how to declare "content", because it might be a string, or an int, or who knows what, just as it is for the "Serial.print" function or the LCD.print() function. Is there an easy way to do this? </p>
 368: <p>One way to do this is to use <a href="http://en.wikipedia.org/wiki/Generic_programming" rel="nofollow">generics</a>. And we also need to use an unnamed <a href="http://en.wikipedia.org/wiki/Namespace" rel="nofollow">namespace</a> to get around the IDE's "helpfulness":</p>

<pre><code>namespace {
    template&lt;typename T&gt;
    void lcdPositionPrint(int row, int col, T content) {
        lcdPosition(row, col);
        LCD.print(content);
    }
}
</code></pre>

<p>This will cause the compiler to create one function for each type passed in <code>content</code> that the function is actually called with.</p>
 1585: <p>There isn't really a great way to do it, but there are a few ways to get it to work. Most of the problem here is that there is actually a different <code>LCD.print</code> function for every data type. You aren't really calling the same function, your calling different functions that share the same name.</p>

<p><strong>You could use templates.</strong> They are a powerful system built into C plus plus for generating functions and avr-gcc supports them well. With them, you can make the compiler generate all the necessary versions of your function for you. Your function would then look like this:</p>

<pre><code>template&lt;typename T&gt;
void lcdPositionPrint(int x, int y, T content) throw() {
  lcdPosition(row, col);
  LCD.print(content);
}
</code></pre>

<p>That part about <code>throw()</code> isn't doing anything except keeping the ".ino" preprocessor from messing the template function up. You can call the templated function like normal, or with an explicit type </p>

<pre><code>lcdPositionPrint(0,0,"hello");
lcdPositionPrint&lt;float&gt;(0,0,32.0f);
</code></pre>

<p><strong>You could also use the preprocessor.</strong> Your function is very simple, so you could just as easily make it a preprocessor macro that just places you code you want in the file whenever your "function call" appears. It looks like this:</p>

<pre><code>#define lcdPositionPrint2(row,col,content) \
    do { lcdPosition(row, col); LCD.print(content); } while (0)
</code></pre>

<p>The <code>\</code> there tells the preprocessor that the next line is also part of the macro, and you will need one on every line but the last of your function. Wrapping it in a <code>do</code> loop that immediately ends makes it nicely substitute into more situations. Micros don't scale up well, but they are a bit simpler for quick debugging situations. The code is duplicated in each call location instead of being bundled into functions though.</p>
