Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

make_pair with string literal

807575Jul 13 2009 — edited Jul 14 2009
Is there any other way to make the below code compile with casting "ABC" to a string?

% CC -V
CC: Sun C++ 5.5 Patch 113817-23 2008/06/24

% cat t.cc
#include <utility>

int main()
{
   std::make_pair( "ABC", true );
   return 0;
}
% CC t.cc
"/opt/SUNWspro-8/SUNWspro/prod/include/CC/Cstd/./utility", line 101: Error: Cannot initialize array member "first" in a constructor argument list.
"t.cc", line 5: Where: While instantiating "std::pair<char[4], bool>::pair(const char(&)[4], const bool&)".
"t.cc", line 5: Where: Instantiated from non-template code.
1 Error(s) detected.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 11 2009
Added on Jul 13 2009
7 comments
658 views