Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 752671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:48:29+00:00 2026-05-14T14:48:29+00:00

I am having problems compiling the following snippet int temp; vector<int> origins; vector<string> originTokens

  • 0

I am having problems compiling the following snippet

int temp; 
vector<int> origins;

vector<string> originTokens = OTUtils::tokenize(buffer, ","); // buffer is a char[] array

// original loop 
BOOST_FOREACH(string s, originTokens)
{
    from_string(temp, s);
    origins.push_back(temp);
}    

// I'd like to use this to replace the above loop
std::transform(originTokens.begin(), originTokens.end(), origins.begin(), boost::bind<int>(&FromString<int>, boost::ref(temp), _1));

where the function in question is

// the third parameter should be one of std::hex, std::dec or std::oct
template <class T>
bool FromString(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&) = std::dec)
{
    std::istringstream iss(s);
    return !(iss >> f >> t).fail();
}

the error I get is

1>Compiling with Intel(R) C++ 11.0.074 [IA-32]... (Intel C++ Environment)
1>C:\projects\svn\bdk\Source\deps\boost_1_42_0\boost/bind/bind.hpp(303): internal error: assertion failed: copy_default_arg_expr: rout NULL, no error (shared/edgcpfe/il.c, line 13919)
1>
1>          return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
1>                                                                                ^
1>
1>icl: error #10298: problem during post processing of parallel object compilation

Google is being unusually unhelpful so I hope that some one here can provide some insights.

UPDATE: Question is answered by @gf’s solution, but interestingly the original function wasn’t quite correct as it stored the result of the conversion operation (failed/not failed) rather than the converted value itself. I changed the signature return the converted value directly and the compiler was able to infer the type of the binding correctly.

// new signature
T FromString(const std::string& s, std::ios_base& (*f)(std::ios_base&) = std::dec);

// revised calling syntax - note that bind<int> is not required. 
transform(originTokens.begin(), originTokens.end(), origins.begin(),  bind(&FromString<int>, _1, std::dec));
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:48:30+00:00Added an answer on May 14, 2026 at 2:48 pm

    FromString() takes 3 arguments and default arguments are not part of a functions type. So the bind expression should probably be something like:

    boost::bind<int>(&FromString<int>, boost::ref(temp), _1, std::dec);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.