I’m trying to use boost::format with Borland C++ Builder 6 (Compiler version 0x564)  and can’t get the boost code to compile.

The code was working with sprintf but I need to be able to use numbered args (i.e. “The first string is %1% and the second string is %2%.” ) for localization so that the language translators can change the position the arguments appear in the translated text. 

 

I get an “E2270 > expected”  error in line of integral_c.hpp  (boost 1_45_0).   which is

template< bool C >

 

The code near the error is:

 

#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \

&& !BOOST_WORKAROUND(__BORLANDC__, <= 0x551)

BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN

// 'bool' constant doesn't have 'next'/'prior' members

template< bool C >

struct integral_c<bool, C>

{

    BOOST_STATIC_CONSTANT(bool, value = C);

    typedef integral_c_tag tag;

 

From what I can tell I should not have to define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION, and defining it I breaks working code.

 

I did find a reference to a bug that affects version Borland compiler versions 0x561 to 0x580 and I tried defining BOOST_BCB_PARTIAL_SPECIALIZATION_BUG.  That did not help, but at least it didn’t break anything.

 

I am able to create a small test project and it works.  I was able to get the same basic code to work in 50 or 60 places in 21 of the 23 *.cpp units in my primary project. 

         

This worked in my test code but broke in my main project.

std::stringstream ss;

          ss << boost::format(LoadStr(STestWithString).c_str()) % "First" % "Second";

          AnsiString translatedMsg = AnsiString(ss.str().c_str());

          ShowMessage(translatedMsg);

 

This also worked in my test program, but broke in my main project.

       std::string sRawMsg;

       AnsiString sDebug1 = "testArg1";

       AnsiString sDebug2 = "testArg2";

       sRawMsg = (boost::format("Testing %1% was first. %2% was second.")

            % sDebug1.c_str() % sDebug2.c_str()).str();

       // ignoreW8080(boost::none); // Suppress false warning - Compiles to a nop.

 

Any suggestions on solving this problem would be greatly appreciated.

 

Royce Fessenden

White Knight Software www.WhiteKnightSw.com 417.766.1852  royce@fessenden.com