Boost logo

Boost :

Subject: [boost] [concept_check] addable
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2012-04-19 17:02:08


Hello all,

Does this Addable concept definition make sense to you? Is there any error?

#include <boost/concept_check.hpp>

template<typename T>
struct Addable { // User-defined concept.
    BOOST_CONCEPT_USAGE(Addable) {
        return_type(x + y); // Check addition `T operator+(T x, T y)`.
    }

private:
    T x;
    T y;

    void return_type(T const&); // Used to check addition returns type `T`.
};

It's not making Sun's linker happy:

"/opt/sunstudio12.1/bin/CC" -g -library=stlport4 -features=tmplife
-features=tmplrefstatic -library=stlport4 -m64 -KPIC -o
"/scratch2/kbelco/boost/results/boost/bin.v2/libs/local_function/test/typeof_seq.test/sun-5.10/debug/address-model-64/stdlib-sun-stlport/typeof_seq"
"/scratch2/kbelco/boost/results/boost/bin.v2/libs/local_function/test/typeof_seq.test/sun-5.10/debug/address-model-64/stdlib-sun-stlport/typeof_seq.o"
-Bdynamic -lrt -Bstatic -Bdynamic

Undefined???first referenced
 symbol ??? in file
void Addable<int>::return_type(const int&)
/scratch2/kbelco/boost/results/boost/bin.v2/libs/local_function/test/typeof_seq.test/sun-5.10/debug/address-model-64/stdlib-sun-stlport/typeof_seq.o
ld: fatal: Symbol referencing errors. No output written to
/scratch2/kbelco/boost/results/boost/bin.v2/libs/local_function/test/typeof_seq.test/sun-5.10/debug/address-model-64/stdlib-sun-stlport/typeof_seq

But the error might also be somewhere else in the program that checks the
concept, I'm still debugging...

Thanks a lot.
--Lorenzo

--
View this message in context: http://boost.2283326.n4.nabble.com/boost-concept-check-addable-tp4572138p4572138.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk