In C++, could you do something with templates instead? Recursion is grandpa's approach at this. Is there a reason beyond protection from potential corruption to restrict a minister's ability to personally relieve and appoint civil servants? Does the policy change for AI-generated content affect users who (want to) How can I iterate over a packed variadic template argument list? Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, Building a safer community: Announcing our new Code of Conduct, Balancing a PhD program with a startup career (Ep. So, for your typical example you need to hack a bit but it still remains concise: At the risk of earning an archaeologist badge, I think there is a minor improvement to Gregory's answer above using the technique from Overloading Macro on Number of Arguments. Does substituting electrons with muons change the atomic shell configuration? I'm sorry but I fail to see how this snippet answers the question. which one to use in this conversation? Is there any evidence suggesting or refuting that Russian officials knowingly lied that Russia was not going to attack Ukraine? Creating intermediate structs will also enforce evaluation order. Not the answer you're looking for? Not the answer you're looking for? Iterate over 2 template parameter packs in parallel, Building a safer community: Announcing our new Code of Conduct, Balancing a PhD program with a startup career (Ep. Removing those and changing the call to FOR_EACH_1 in FOR_EACH_2 removed this warning. How can I iterate over variadic template parameters in c++? Why is it "Gaudeamus igitur, *iuvenes dum* sumus!" The answers above work -- here I explore a bit more on using a lambda for complex use cases. Just remove it. Insufficient travel insurance to cover the massive medical expenses for a visitor to US? This is really a great answer. Sorted by: 1. Korbanot only at Beis Hamikdash ? What does "Welcome to SeaWorld, kid!" Making statements based on opinion; back them up with references or personal experience. rev2023.6.2.43474. 2 or more template parameters: The number of template parameter will define the number of single disks of the Odometer. You can create intermediate structs rather than bool array. Living room light switches do not work during warm/hot weather. Should I trust my own thoughts when studying philosophy? By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Is it OK to pray any five decades of the Rosary or do they have to be in the specific set of mysteries? Noise cancels but variance sums - contradiction? You need either. I was wondering whether it would be possible to split up a, That's a nice trick Gregory. Recursive template parameter pack programming. Inside I call another function, which recursively iterates the given arguments. No I need to think on what to use . Just removing the x parameter from the FOR_EACH macro. However, lambdas allow you to capture variables like: To enable for an empty __VA_ARGS__, one can use the GNU extension ##_VA_ARGS__ Lets say I want to be able to take every string argument and append an exclamation mark before printing it out on a new line. Connect and share knowledge within a single location that is structured and easy to search. How does one show in IPA that the first sound in "get" and "got" is different? But, I need to iterate also over the tuple elements of the "disks", defined by the class template parameters. https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html. Think deeper. Is there anything called Shallow Learning? But here's my idea for iterating over var-args: This is the best I can think of, with standard C: I'm adding this as another answer. Can I trust my bikes frame after I was hit by a car if there's no visible cracking? Now I would need iterate over the elements of both parameter packs at the same time in parallel. In Europe, do trains/buses get transported by ferries with the passengers inside? Im waiting for my US passport (am a dual citizen. My father is ill and booked a flight to see him - can I travel on my other passport? How much of the power drawn by a chip turns into heat? Then you can expand both packs in one for the general case, and you only have one pack for the special case. How appropriate is it to post a tweet saying that I am looking for postdoc positions? Other tasks are a bit trickier to accomplish, such as iterating How can I iterate over a packed variadic template argument list? It looks good, but I see one problem. To create a context for pack expansion I used the argument list of a function that does nothing (dummy): As an example, suppose you want to display each A::var. rev2023.6.2.43474. How, exactly, does the double-stringize trick work? By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Please see the below code example for an illustration of the problem (I deleted most of the code in the class, to just show you the problem): I can iterate over the parameter pack of the constructor using a fold expression. Is there liablility if Alice scares Bob and Bob damages something? Connect and share knowledge within a single location that is structured and easy to search. create structs, dont execute anything. How can I define top vertical gap for wrapfigure? How to expand variadic arguments in a macro? Execution and expansion are not the same thing. Exactly what I need. Both parameter pack expansion and the "variadic" ellipsis may appear in the declaration of a function template, as in the case of As you can see, one doesn't even need a class here. It's an alternative for those using C++11 and willing to avoid macros. Take them as a parameter pack. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. You should be able create function overloads for calling lua_push and use a fold expression instead of the loop. How can I divide the contour in three parts with the same arclength? still, the use of this array means 2 things: all the arguments passed through the variable argument list need to be of the same type (in your case. "I don't like it when it is rainy." What happens if you've already found the item an old map leads to? By clicking Post Your Answer, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct. Is variadic macro subsitution for every argument possible? Simple expansion is what you're searching for: If you're looking at something like array, then it is array. Semantics of the `:` (colon) function in Bash when used in a pipe? Did an AI-enabled drone attack the human operator in a simulation environment? When a unary fold is used with a pack expansion of length zero, only the following operators are allowed: If the expression used as init or as pack has an operator with precedence below cast at the top level, it must be parenthesized: The following behavior-changing defect reports were applied retroactively to previously published C++ standards. Why are mountain bike tires rated for so much lower pressure than road bikes? By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Why doesnt SpaceX sell Raptor engines commercially? Use of Stein's maximal principle in Bourgain's paper on Besicovitch sets. How to iterate over Variadic template types (not arguments)? How does one show in IPA that the first sound in "get" and "got" is different? I have a struct receiving a parameter pack. How common is it to take off from a taxiway? Insufficient travel insurance to cover the massive medical expenses for a visitor to US? Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, How to iterate over the size of a parameter pack with a compile-time index parameter, Building a safer community: Announcing our new Code of Conduct, Balancing a PhD program with a startup career (Ep. I could also use std::apply. How can I divide the contour in three parts with the same arclength? Ways to find a safe route on flooded roads. Does the policy change for AI-generated content affect users who (want to) c++ macro to import all names of base template class, C11 variadic macro : put elements into brackets. To learn more, see our tips on writing great answers. Making statements based on opinion; back them up with references or personal experience. Iterating over vectors in a parameter pack. Here is a try at doing it with C++0x, compiled with g++ 4.5.0. I thought I could do this using sizeof(Args) as follows: This doesn't compile because std::get(args) requires i to be a compile time constant. But here's my idea for iterating over var-args: Mine is below. which one to use in this conversation? The way to go is to move the code from the lambda's args to code: Thanks for contributing an answer to Stack Overflow! Iterating over a parameter pack of structured templates. 576), AI/ML Tool examples part 3 - Title-Drafting Assistant, We are graduating the updated button styling for vote arrows. There are many ways to do this, and the solutions get easier to read Which fighter jet is this, based on the silhouette? In GraphQL, how to control DB query by client query? Is there a reason beyond protection from potential corruption to restrict a minister's ability to personally relieve and appoint civil servants? donnez-moi or me donner? Apparently the compiler keeps trying to compile the recursive function, but not the overload to stop the recursion. Why shouldnt I be a skeptic about the Necessitation Rule for alethic modal logics? By clicking Post Your Answer, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct. For example: Use a parameter pack with a fold expression: Here is an iterative solution. Do we decide the output of a sequental circuit based on its present state or next state? rev2023.6.2.43474. Often, we need to perform an operation over every element in a variadic template parameter pack. The only idea I have now is to use a helper class with a Connect and share knowledge within a single location that is structured and easy to search. For example I pass in a function which prints out two integers that I pass in. Why is this screw on the wing of DASH-8 Q400 sticking out, is it safe? I'm currently trying to implement a function, which accepts some data and a parameter-pack args. After expansion is completed, use iterators to determine the index. How to print a variable number of parameters with a macro? Iterating over types in a variadic template. This does not work for the use case, where I want 1 template parameter like. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. IIRC, before C++17 this doesn't have strong evaluation order, so it might fail you sometimes. This won't work because i is not a constant expression. i.e. Asking for help, clarification, or responding to other answers. Can I trust my bikes frame after I was hit by a car if there's no visible cracking? Which fighter jet is this, based on the silhouette? To attain moksha, must you be born as a Hindu? What happens if you've already found the item an old map leads to? C++11 indexing template parameter packs at runtime in order to access Nth type, How do I get index of elements in parameter pack. But I had two minor problems with it: Compiling with the pedantic option I got the warning: "ISO99 requires rest arguments to be used". Also, at the time I think there was no C tag in the question. How can I shave a sheet of plywood into a wedge shim? Is it possible to handle each element in a variadic macro at compile time in C? How to use SWIG to wrap std::function objects? which one to use in this conversation? 576), AI/ML Tool examples part 3 - Title-Drafting Assistant, We are graduating the updated button styling for vote arrows. Applications of maximal surfaces in Lorentz spaces. For C++14, you have to fall back on using template specializations and function objects: Thanks for contributing an answer to Stack Overflow! Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. It's not. Is it possible to iterate over arguments in variadic macros? Asking for help, clarification, or responding to other answers. How to extract a value from a variadic template parameter pack by index? when you have Vim mapped to always print two? Living room light switches do not work during warm/hot weather, Recovery on an ancient version of my TexStudio file. Template parameter pack (appears in alias template, class template, variable template (since C++14) and function By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. I started to implement a very flexible Odometer. The first is a fold-expression: And the second is if constexpr, which allows us to write our original recursive solution in a single function: Found a mistake? sizeof(array)/sizeof(array[0]). To attain moksha, must you be born as a Hindu? How to make a HUE colour node with cycling colours. Suppose we simply want to print every element in a pack. First story of aliens pretending to be humans especially a "human" family (like Coneheads) that is trying to fit in, maybe for a long time? Can I also say: 'ich tut mir leid' instead of 'es tut mir leid'? . std::index_sequence, but I do not know. Asking for help, clarification, or responding to other answers. In July 2022, did China have more nuclear weapons than Domino's Pizza locations? The var-arg part might as well be a single argument that has commas in it, for all you can do to it with CPP, AFAIK. VS "I don't like it raining.". The base macro ksva_iterate_list() iterates over the variable arguments, invoking a block for each argument, until it encounters a terminating nil. One problem might arise if the order of invocation matters. It only obfuscates the declaration of the structure and the function that prints the offsets, but not that much when you know the effect of the X() macro. Making statements based on opinion; back them up with references or personal experience. Is there any evidence suggesting or refuting that Russian officials knowingly lied that Russia was not going to attack Ukraine? Reduces (folds) a parameter pack over a binary operator. Thanks for catching the missing [], though. Also a very good answer! Optional: your email if you want me to get back to you: // this line will only be instantiated if there are further, // arguments. Hydrogen Isotopes and Bronsted Lowry Acid. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, Neat. en.cppreference.com/w/cpp/language/parameter_pack, boost.org/doc/libs/1_60_0/doc/html/boost/algorithm/join.html, Building a safer community: Announcing our new Code of Conduct, Balancing a PhD program with a startup career (Ep. template void print (T value) { std::cout << value << std::endl; Why does bunched up aluminum foil become so extremely hard to compress? Of course there are exceptions though. How can an accidental cat scratch break skin but not damage clothes? How could this be done? Each disk has the data type of the template parameter. How can I manually analyse this simple BJT circuit? But the advantage is that when you have to add a new field to the structure, you only have one place to modify, the X_FIELDS macro. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. I'm using this to build up a tuple which I then apply on the callback function which determined the template types. Regarding option 2, notice that the order in which the elements are processed is not specified by the standard. [ capture ]( params ){ code }( args to call "in-place" ); If you want to expand a lambda with a variadic template, it won't work as mentioned above when the parameters is of a non-trivial type: Variadic recursive preprocessor macros - is it possible? The best way is to use parameters pack. C++17 Iterate over a subset of parameter pack. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. Something like this: But you can also iterate with recursion, which might be easier in your case: Thanks for contributing an answer to Stack Overflow! I had stumbled upon the, I've seen how the double-stringize works in, Henk > in fact i don't remember why, it's been in my codebase for ages. What happens if you've already found the item an old map leads to? Find centralized, trusted content and collaborate around the technologies you use most. Insufficient travel insurance to cover the massive medical expenses for a visitor to US? lol, yeah, my question is pretty old, you can even do better in c++20 and make the lambda accept, iterating over variadic template's type parameters, Building a safer community: Announcing our new Code of Conduct, Balancing a PhD program with a startup career (Ep. All this shall be implemented with one class. rev2023.6.2.43474. Not the answer you're looking for? Connect and share knowledge within a single location that is structured and easy to search. "); } // Modify multiple strings. You could make the type one of the macro params. Is there a reliable way to check if a trigger being fired was the result of a DML action from another *specific* trigger? Lambda 101: [ capture ] ( params ) { code } ( args to call "in-place" ); If you want to expand a lambda with a variadic template, it won't work as mentioned above when the parameters is of a non-trivial type: I can't think of another way to iterate over the var-args of a macro, since I don't know how to do anything to the text of each var-arg element. The only idea I have now is to use a helper class with a std::index_sequence, but I do not know. It's possible to write a helper function to iterate over a parameter pack: // Invoke each of the functions `f` in sequence template void In that case, I suppose, one could add a comma and 0, i.e. Something like this: template // Modify single string. It indeed obfuscates the code but makes the final user experience better and without constraints. For those attempting this with msvc (2015 here), this needs to be slightly modified since msvc does not expand. I was wondering if it is possible to iterate over arguments passed to a variadic macro in C99 or using any GCC extensions ? If you have a list of strings then first if you need to modify strings then you can use. Don't use recursion unless required, as it usually makes it complicated. And, as an extension, even the data type of values on each of the single disks could be different. Is it the right and the only way to iterate over a parameter pack with std::tuple? Furthermore, even if Index == TotalSize - 1, the compiler is still forced to instantiate ParseCompositeFields (as it has to compile the if-branch), which effectively is ParseCompositeFields. iterating over variadic template's type parameters, Iterating a parameter pack with variadic templates in c++. 2 or more template parameters: The number of template parameter will define the number of single disks of the Odometer. Recompile and the print_offset() function will print the offset of the new field. How can I iterate over variadic template parameters in c++? I'm trying to write a variadic template function that includes a loop that iterates over each type in the parameter pack. How does TeX know whether to eat this space if its catcode is about to change? EDIT: These days (c++17), I'd do it like this: What Xeo said. There are many ways to do this, and the solutions get easier to read and write with C++17. This page has been accessed 496,016 times. This however will lead to the error your got when trying to instantiate std::get. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, Your parameter pack is not decreasing, but index is increasing. Of course, you can do this with recursion, simply ending the recursion when you hit the stop It may have several disks with even different amount of values on each different disk. Is there a reliable way to check if a trigger being fired was the result of a DML action from another *specific* trigger? I did something similar, but with a parameter-less Y macro after all but the last X, to allow for the fact that in some contexts it's necessary to have a separator between items rather than a terminator after each. By clicking Post Your Answer, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct. Note that the opening and closing parentheses are a required part of the fold expression. 576), AI/ML Tool examples part 3 - Title-Drafting Assistant, We are graduating the updated button styling for vote arrows. Which comes first: CI/CD or microservices? Find centralized, trusted content and collaborate around the technologies you use most. rev2023.6.2.43474. rev2023.6.2.43474. How to make a variadic macro (variable number of arguments). The solution of Gregory Pakosz worked great. \utility(446): error C2338: tuple index out of bounds What are some good resources for advanced Biblical Hebrew study? Let's assume that the parameter pack will never have a size smaller than 3. So in order to conditionally compile the if-branch only when the condition is fulfilled, you would have to use if constexpr(Index < TotalSize - 1) (see on godbolt). This has the advantage of not needing a second overload, but has the disadvantage of less than stellar readability: For an explanation of how this works, see T.Cs excellent answer. Is graphql schema circular reference an anti-pattern? I have a function that takes in a parameter pack of vectors, These vectors will be of the same length, and I want to call a function with the values of both of these vectors at each index. How common is it to take off from a taxiway? I see three ways to acomplish this as the code below illustrates. 576), AI/ML Tool examples part 3 - Title-Drafting Assistant, We are graduating the updated button styling for vote arrows. How to iterate over variadic function with std:string arguments? Don't have to recite korbanot at mincha? 576), AI/ML Tool examples part 3 - Title-Drafting Assistant, We are graduating the updated button styling for vote arrows. First of all, to be logically correct, the condition should read Index < TotalSize - 1., as tuple element counts are zero-based. Check of number of elements in parameter packs and type will be done later. rev2023.6.2.43474. In C++20 you can just define template lambda inside the function to do this. and only applies if the structure is yours and you are willing to clutter (imho) its definition. Does a knockout punch always carry the risk of killing the receiver? Asking for help, clarification, or responding to other answers. when you have Vim mapped to always print two? Can I trust my bikes frame after I was hit by a car if there's no visible cracking? What does Bell mean by polarization of spin state? Inside I call another function, which recursively iterates the given arguments. For this example GCC, for instance, process the elements in this order S3::var, S2::var and S1::var. If your structure is described with X-Macros, then it is possible to write a function, or a macro to iterate over all the fields of the structure and print their offset. mean? WebSome things are easy to do with parameter packsfor instance, passing the values they comprise to a function. mean? What could I do? Does the policy change for AI-generated content affect users who (want to) How to make generic computations over heterogeneous argument packs of a variadic template function? Citing my unpublished master's thesis in the article that builds on top of it. First story of aliens pretending to be humans especially a "human" family (like Coneheads) that is trying to fit in, maybe for a long time? WebThe best way is to use parameters pack. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. I do not want to use recursive templates. Does the Fool say "There is no God" or "No to God" in Psalm 14:1. Making statements based on opinion; back them up with references or personal experience. and it seems like a stringstream with a loop is the most efficient way. Theoretical Approaches to crack large files encrypted with AES. I've thought about using a fold expression but. Asking for help, clarification, or responding to other answers. To learn more, see our tips on writing great answers. To use a std::tuple to iterate over a parameter pack, you would usually use a std::index_sequence to introduce a new pack of indices, and use a fold expression to do the actual iteration. Living room light switches do not work during warm/hot weather, Citing my unpublished master's thesis in the article that builds on top of it. How to iterate over Variadic template types (not arguments)? Why do some images depict the same constellations differently? The answers above work -- here I explore a bit more on using a lambda for complex use cases. This is clear to me. So, I need to iterate of 2 parameter packs in parallel at the same time. Why are mountain bike tires rated for so much lower pressure than road bikes? How can I divide the contour in three parts with the same arclength? Making statements based on opinion; back them up with references or personal experience. error: cannot pass object of non-trivial type 'Foo' through variadic method; call will abort at runtime. Making statements based on opinion; back them up with references or personal experience. It has one issue: the order in which the elements are processed is not specified by the standard. I need to define a function with template parameter pack with C++14. Please be reminded. donnez-moi or me donner? Im waiting for my US passport (am a dual citizen. Should I include non-technical degree and non-engineering experience in my software engineer CV? Is there anything called Shallow Learning? How to use Variadic Function with strings, without using templates? Find centralized, trusted content and collaborate around the technologies you use most. Does the policy change for AI-generated content affect users who (want to) recursive variadic template to print out the contents of a parameter pack, Iterating a parameter pack with variadic templates in c++. So, you just have to define a macro that takes a single argument like this: which is going to be applied to every argument in the list. To learn more, see our tips on writing great answers. Thanks for contributing an answer to Stack Overflow! instantiation 'std::tuple_element<3,std::tuple>' being compiled. Semantics of the `:` (colon) function in Bash when used in a pipe? I use X-macros way too often! Can you please show how to do this without recursion? Why is it "Gaudeamus igitur, *iuvenes dum* sumus!" Iterating a parameter pack with variadic templates in c++. Is there a way to make this work? Is it possible? I omit the check for the moment and will add it later. Here is my homework of the day, it's based on macro tricks and today I particularly learnt about __VA_NARG__ invented by Laurent Deniau. WebSometimes you want to iterate over a parameter pack until some condition holds. Is it OK to pray any five decades of the Rosary or do they have to be in the specific set of mysteries? @Blacktempel If this is clear to you, why do you ask then? To subscribe to this RSS feed, copy and paste this URL into your RSS reader. So, I have the parameter pack off the class and the parameter pack of the constructor. How to iterate through variadic template parameters to create variable number of local variables? My father is ill and booked a flight to see him - can I travel on my other passport? They shouldnt be allowed anyway. I'm not claiming it's a good or generally useful answer! WebOften, we need to perform an operation over every element in a variadic template parameter pack. Also, the std::array found in the struct should be evaluated at compile-time. Obviously you need to adjust the macro to fit your situation. // return ((true && true) && true) && false; // return (args + + 1 * 2); // Error: operator with precedence below cast, https://en.cppreference.com/mwiki/index.php?title=cpp/language/fold&oldid=148410, an expression that contains an unexpanded, an expression that does not contain an unexpanded, the expansion results of fold expressions were not enclosed with parentheses. if rest is empty, there will be no call to. Can you check my solution? Which fighter jet is this, based on the silhouette? What are good reasons to create a city/nation in which a government wouldn't let you leave. Find centralized, trusted content and collaborate around the technologies you use most. This is caused by the variad arguments in the first FOR_EACH_1 macro. Does the policy change for AI-generated content affect users who (want to) GraphQL: How to restrict fields server-side across queries? Since i used it in a very generic way, i sometimes had to call the repeat macro with only 1 argument. WebThe simplest solution is to recurse: void print_all(std::ostream& os) { // base case } template void print_all(std::ostream& os, T const& first, Ts const& rest) { It may be the best you can do in C99 / GNU C, though. What does "Welcome to SeaWorld, kid!" The array could potentially be a C99 anonymous array. Efficiently get the size of a parameter pack up to a certain index. Insufficient travel insurance to cover the massive medical expenses for a visitor to US? Then there's the small issue with it being undefined behavior to pass a variadic function anything that isn't a builtin type thanks yaranov, is there an iterative way to do this? As pretty as it was. In general relativity, why is Earth able to accelerate? actually, i misread the question, i thought he wanted to output the. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Why do you need index anyway? Korbanot only at Beis Hamikdash ? Of course types and number of arguments must match. Thanks for contributing an answer to Stack Overflow! You don't need recursion. Why wouldn't a plane start its take-off run from the very beginning of the runway to keep the option to utilize the full runway if necessary? How appropriate is it to post a tweet saying that I am looking for postdoc positions? Making statements based on opinion; back them up with references or personal experience. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Connect and share knowledge within a single location that is structured and easy to search. . Not the answer you're looking for? The FOR_EACH(what, ) macro applies what to every other argument in the variable argument list. Using a function with variable argument strings, C++ Extract std::string from a variable-length argument list, C++ variable arguments with std::string only, Iterating through parameters of a variadic function template using variadic lambda, Proper way of using Variadic template function call with string arguments c++, Calling a variadic function with an unknown number of parameters, how to write variadic function for any number of string concatenation in c++.
How To Close Microsoft Edge In Windows 11,
Epplus Autofit Columns,
Balochistan Board Intermediate Date Sheet 2022,
Blackout During Car Accident,
What Percentage Of Vietnam Speaks French,
Pyspark Window Rangebetween,
Lancaster, Pa Summer Camps 2022,
Redshift_connector Cursor,
Mongoose Connect To Mongodb,