c++

What are the good parts in the poorly-thought-of non-standard C++ libraries?

In trying to get up to speed with C++ (coming from a long experience with C), I am obviously trying to do the right thing, and use as much as is standard as is possible. However, in my readings on the matter I come accross a lot of criticism for standard things, and praise for non-standard things. For example, even the the (I assume) po...

Is the maven-native-plugin widely used to build C++ projects using maven?

It's been a little while since I did C++ development professionally and I'd like to get caught up on what the current state of C++ development is in a number of areas. Most of my recent work has been Java, making heavy use of Maven. When I last did C++ development for work, some variant of make was widely accepted as the way to go for ...

Does the new C++ Standard provide new containers?

With C++ STL being updated, will there ever be a set number of containers. Edit: When it comes to containers, Will there be new addition to the library in addition vectors, lists etc.. ...

why STL header files have no extension?

I got this basic doubt. The STL header doesn't have .h extension. #include <vector> #include <map> Is there is any specific reason behind this? Anybody knows history behind this, please share. EDIT: @GMan found Michael Burr's answer which addresses this question. ...

Conversion of ref to TBuf

Hi, I am using CRSAKeypair class which returns the public key and private key which is in long format , i want it to convert to TBuf format how should i proceed . I have tried creation of pointers but still no luck .. is there any other way ...

Read Unicode files C++

Hi all, I have a simple question to ask. I have a UTF 16 text file to read wich starts with FFFE. What are the C++ tools to deal with this kind of file? I just want to read it, filter some lines, and display the result. It looks simple, but I just have experience in work with plain ascci files and I'm in the hurry. I'm using VS C++, b...

Upgrading from boost 1.38 to 1.39 causes my call to boost::algorithm::split not to compile

Hello all :) I was using Boost 1.38, and I just upgraded to 1.39. Upgrading broke the following bit of code: std::vector<std::wstring> consoleParser::loadStringsFromFile(const std::wstring &fileName) { std::vector<std::wstring> files; std::wstring fileString(loadFileAsString(fileName)); boost::algorithm::split(files, fileSt...

Order like a list but access by a key?

I used list to place cities into a trip. Then I iterate over the list to display the trip itinerary. I would like to access the cities by the name rather than by the trip order. So, I thought I could use a map rather than a list but the key determines the order. I would still like to control the order of the sequence but be able to acces...

Make a c++ iterator that traverses 2 containers

I have a need for a "container" that acts like the following. It has 2 subcontainers, called A and B, and I need to be able to iterate over just A, just B, and A and B combined. I don't want to use extra space for redundant data, so I thought of making my own iterator to iterate over A and B combined. What is the easiest way to make your...

How to use typelists

I read about typelists in 'Modern C++ Design' and I understood it as some kind of union for types. By putting diffrent, non-related types in a typelist, one can use it to represent more than one type at once, without inheritance. I tested typelist in some simple functions with primitive types, but I couldn't get any of them to work. Cou...

What are some of the more obscure parts of C++?

I've read quite a few beginner's books on C++, and a little beyond that, but what are some of the more obscure aspects of C++, or where can I find information/tutorials on these? ...

Advantage using an aggregate initialization list over a constructor?

Hello, I'm new to C++ and I have a question... I tried answering the question myself by making a test application... in debug, the class B initialization generates less assembly code, but in release mode, I can't really say... it optimizes the initializations away :( Let's say I have two classes: class A { public: int a, b, c, d;...

What is the reverse of cout.width? (C++)

I was trying std::cout.width(int) to see what it did, and it pushes the text right to fill a minimum width: TH becomes: TH to fill a minimum width of 10. I am wondering if A) there is a way to reverse this, have a number of spaces put AFTER the text to fill a minimum width, and B) is there a way to create a maximum width AN...

c++ typedef another class's enum?

So here's my problem: struct A { enum A_enum { E0, E1, E2 }; }; struct B { typedef A::A_enum B_enum; bool test(B_enum val) { return (val == E1); // error: "E1" undeclared identifier } }; I specifically do not want to say A::E1. If I try B_enum::E1 I receive a warning that it...

Is there a decent wait function in C++?

One of the first things I learned in C++ was that #include<iostream> int main() { std::cout<<"Hello, World!\n"; return 0; } would simply appear and disappear extremely quickly without pause. To prevent this, I had to go to notepad, and save helloworld.exe pause ase helloworld.bat This go tedious when I needed to create ...

Why does this program display seemingly random characters? (C++)

Well, not random, because its the same every time, but #include<iostream> using namespace std; int main() { char box[10][10]; for(int i=-1;i<11;i++) { cout<<"---------------------"<<endl<<"|"; for(int j=0;j<10;j++) { cout<<box[j][i]<<"|"; } cout<<endl; } intx;cin>>x...

Point-triangle intersection in 3d from mouse coordinates?

I know how to test intersection between a point and a triangle. ...But i dont get it, how i can move the starting position of the point onto the screen plane precisely by using my mouse coordinates, so the point angle should change depending on where mouse cursor is on the screen, also this should work perfectly no matter which perspect...

I wanted to be a programmer

Hello, let me ask your opinion. I'm 25 now, living in Germany. I started with QBASIC, did some Java in Highschool, and after School I created some Websites in PHP. Now, because my Company is Microsoft Gold Partner, I've to use Microsoft all the time. C#, MSSQL, ASPX and Sharepoint <- I really hate it! So, in my spare I concentrate to ...

When to use Header files that do not declare a class but have function definitions

I am fairly new to C++ and I have seen a bunch of code that has method definitions in the header files and they do not declare the header file as a class. Can someone explain to me why and when you would do something like this. Is this a bad practice? Thanks in advance! ...

Is it possible to derive functions from functions?

I'm wondering if it is possible to derive functions from functions, similar to how classes can be derived from other classes? And if C++ does not explicitly allow this, is there a way to somehow indirectly derive functions from functions? ...