Q:

Is it preferable to create your own required desired function than to include whole library for some function

Suppose i want to use some standard set function so is it good for me to use set.h or create my own files which contains declare and definition of function similar to set useful for my project . Will this in some way make my overall executable for library small or efficient or will save some memory as the complete libraries are not to be included .
I am little confused on this 

A:

It depends:
If your question is about template library then the compiler generates code for only those template which you use so including the entire template code just increases your code size but not the generated binary size.     
If you are talking of a non-standard non template library then the choice is a trade off between re-inventing the wheel or being okay with increased binary size. Choose whichever suits your project, If binary size is a concern reinvent the wheel for yourself, if not choose the library and be start building the vehicle since your wheels are already in place then.

