Boost logo

Boost Users :

From: Caleb Epstein (cae_at_[hidden])
Date: 2004-05-28 15:43:59


        I'm trying to use the "get" template with boost::variant but
        can't figure out how to get my compiler to recognize it.

        Here's a simple test program:

---
#include <iostream>
#include <cmath>
#include <string>
#include <boost/variant.hpp>
using namespace boost;
using namespace std;
typedef variant<int, double, string> elem_t;
int main ()
{
    elem_t pi = M_PI;
    double d = get (pi);
    cout << "pi =~ " << d << endl;
    return 0;
}
---
	But my compiler (gcc 3.3.2) tells me:
g++  -I/home/tools/boost-1.31.0   test.cpp   -o test
test.cpp: In function `int main()':
test.cpp:15: error: no matching function for call to `get(elem_t&)'
	I'm using Boost 1.31.0.  Thanks for any help,
-- 
Caleb Epstein |  bklyn . org  |     The Golden Rule of Arts and Sciences:
    cae at    | Brooklyn Dust |     	He who has the gold makes the rules.
bklyn dot org |   Bunny Mfg.  |

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net