Please ignore the following part of my previous email:

On Wed, Jul 16, 2014 at 9:14 PM, Klaim - Joël Lamotte <mjklaim@gmail.com> wrote:
Then I hit the same link error I reported previously, from optional code apparently:

3>typevaluemap.obj : error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl boost::operator<<<char,struct std::char_traits<char>,int>(class std::basic_ostream<char,struct std::char_traits<char> > &,class boost::optional<int> const &)" (??$?6DU?$char_traits@D@std@@H@boost@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABV?$optional@H@0@@Z) referenced in function "void __cdecl testing_internal::DefaultPrintNonContainerTo<class boost::optional<int> >(class boost::optional<int> const &,class std::basic_ostream<char,struct std::char_traits<char> > *)" (??$DefaultPrintNonContainerTo@V?$optional@H@boost@@@testing_internal@@YAXABV?$optional@H@boost@@PAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z)

I investigated further and found that this error only occur in when this function have been compiled:

template< class ValueType >
    inline boost::optional<ValueType> TypeValueMap::read() const
    {
        auto* slot = m_slot_index.find<ValueType>();
        if( slot && slot->value )
        {
            return slot->value.get();
        }
        return {};
    }

With slot's type  looking like this:

    template< class ValueType >
        struct SlotOf : public Slot
        {
            boost::optional<ValueType> value;
            //...

Maybe I did something wrong here? 
However, the link error report suggest that some boost optional's testing function is called when it shouldn't (this appear when I'm compiling my own project).


I found that it's a link issue related to GTest macros which apparently generate this error when I try to test the optional result implicitely:

#include <gtest/gtest.h>
#include <boost/optional.hpp>

TEST( blah, blah )
{
    boost::optional<int> k = 42;
    EXPECT_EQ( 42, k ); // this will trigger the link error
}

Replacing the pointed line by 
   EXPECT_EQ( 42, k.get() ); // OK

seems to fix the issue.

Sorry for the noise!